[pacman-dev] [PATCH] makepkg: bzr: update existing sources in srcdir without removing them first.
The local changes are discarded when updating. This matches the behaviour when non-VCS sources are used. It also allows incremental builds. This changes semantics a bit. Previously using "bzr revno" would obtain the revision of the working tree. After this change, it is necessary to use "bzr revno --tree" to achieve the same result. The reasoning behind this change is that "bzr pull" that was previously used actually altered the original clone, making it impossible to freely navigate through the history when the internet connection wasn't available. Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com> --- scripts/makepkg.sh.in | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 7d3c28b..f0e19ed 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -499,10 +499,11 @@ extract_bzr() { unset fragment fi + rev="last:1" if [[ -n $fragment ]]; then case ${fragment%%=*} in revision) - revision=("-r" "${fragment#*=}") + rev="${fragment#*=}" displaylocation="$url -r ${fragment#*=}" ;; *) @@ -517,10 +518,16 @@ extract_bzr() { msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && - ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + if ! (bzr update -q -r "$rev" && bzr clean-tree -q --detritus --force); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "bzr" + plain "$(gettext "Aborting...")" + exit 1 + fi + elif ! { bzr checkout "$dir" -r "$rev" --lightweight && + ( cd "$repo" && bzr pull "$dir" -q --overwrite -r "$rev" ); }; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" exit 1 -- 2.0.1
On 01/07/14 19:38, Lukáš Jirkovský wrote:
The local changes are discarded when updating. This matches the behaviour when non-VCS sources are used. It also allows incremental builds.
This changes semantics a bit. Previously using "bzr revno" would obtain the revision of the working tree. After this change, it is necessary to use "bzr revno --tree" to achieve the same result.
The reasoning behind this change is that "bzr pull" that was previously used actually altered the original clone, making it impossible to freely navigate through the history when the internet connection wasn't available.
Signed-off-by: Lukáš Jirkovský <l.jirkovsky@gmail.com> --- scripts/makepkg.sh.in | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 7d3c28b..f0e19ed 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -499,10 +499,11 @@ extract_bzr() { unset fragment fi
+ rev="last:1" if [[ -n $fragment ]]; then case ${fragment%%=*} in revision) - revision=("-r" "${fragment#*=}") + rev="${fragment#*=}" displaylocation="$url -r ${fragment#*=}" ;; *) @@ -517,10 +518,16 @@ extract_bzr() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
- if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && - ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + if ! (bzr update -q -r "$rev" && bzr clean-tree -q --detritus --force); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "bzr" + plain "$(gettext "Aborting...")" + exit 1 + fi + elif ! { bzr checkout "$dir" -r "$rev" --lightweight && + ( cd "$repo" && bzr pull "$dir" -q --overwrite -r "$rev" ); }; then
The "bzr pull" you are concerned about in your text above is still here. Is this supposed to be "bzr update -q -r "$rev"?
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" exit 1
On 09/11/14 19:08, Allan McRae wrote:
On 01/07/14 19:38, Lukáš Jirkovský wrote:
The local changes are discarded when updating. This matches the behaviour when non-VCS sources are used. It also allows incremental builds.
This changes semantics a bit. Previously using "bzr revno" would obtain the revision of the working tree. After this change, it is necessary to use "bzr revno --tree" to achieve the same result.
The reasoning behind this change is that "bzr pull" that was previously used actually altered the original clone, making it impossible to freely navigate through the history when the internet connection wasn't available.
After spending too much time on this stupid VCS... this is what I have figured out that actually works, gives the right 'bzr revno' and does not alter the original copy. Download: bzr branch "$url" "$dir" --no-tree --use-existing-dir Update: bzr pull "$url" (--overwrite ??) Create local working copy at a given revision: bzr checkout "$dir" -r "${revision[@]}" Update local copy to given revision: bzr pull "$dir" -q --overwrite -r 80 bzr clean-tree -q --detritus --force I will adjust the patch from Lukáš to use these commands unless someone tells me that I missed something. Allan
participants (2)
-
Allan McRae
-
Lukáš Jirkovský