Christian Hudon wrote:
> Bazaar supports a concept of "checkouts", which basically keeps a
> designated remote repository in sync with the local one. For example,
> running "bzr update" on a checkout will automatically pull from the
> remote repository, and doing a commit will automatically push.
> 
> It'd be nice if mr would do the right thing automatically for bazaar
> checkouts. Basically this would mean recognizing that the repository is
> a bazaar checkout, and then using "bzr update" for the update command
> and not doing a push after commit for the commit command.
> 
> One way of recognizing if a directory is a bazaar checkout (there may be
> better ones) is to run bzr info on it. If it's a checkout, the first
> word will be "Checkout".

So something like this then. Please let me know if it works.

-- 
see shy jo
diff --git a/debian/changelog b/debian/changelog
index 766b8da..7778c99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mr (1.05) UNRELEASED; urgency=low
+mr (1.05) unstable; urgency=low
 
   * Avoid using sed -r in git-fake-bare, for OSX portability.
   * git-fake-bare: handle fake bare repositories with core.bare not set
@@ -10,7 +10,7 @@ mr (1.05) UNRELEASED; urgency=low
     So skip=true or deleted=true canbe used in an untrusted mrconfig file.
   * Also allow order=N in an untrusted mrconfig file.
 
- -- Joey Hess <jo...@debian.org>  Fri, 05 Aug 2011 13:29:21 -0400
+ -- Joey Hess <jo...@debian.org>  Tue, 27 Sep 2011 17:28:35 -0400
 
 mr (1.04) unstable; urgency=low
 
diff --git a/mr b/mr
index d5424ca..10a547f 100755
--- a/mr
+++ b/mr
@@ -1688,6 +1688,9 @@ lib =
                        return 0
                fi
        }
+       is_bzr_checkout() {
+               LANG=C bzr info | egrep -q '^Checkout'
+       }
 
 svn_test = test -d "$MR_REPO"/.svn
 git_test = test -d "$MR_REPO"/.git
@@ -1703,7 +1706,12 @@ git_bare_test =
 
 svn_update = svn update "$@"
 git_update = git pull "$@"
-bzr_update = bzr merge --pull "$@"
+bzr_update = 
+       if is_bzr_checkout; then
+               bzr update "$@"
+       else
+               bzr merge --pull "$@"
+       fi
 cvs_update = cvs update "$@"
 hg_update  = hg pull "$@" && hg update "$@"
 darcs_update = darcs pull -a "$@"
@@ -1719,7 +1727,12 @@ fossil_status = fossil changes "$@"
 
 svn_commit = svn commit "$@"
 git_commit = git commit -a "$@" && git push --all
-bzr_commit = bzr commit "$@" && bzr push
+bzr_commit = 
+       if is_bzr_checkout; then
+               bzr commit "$@"
+       else
+               bzr commit "$@" && bzr push
+       fi
 cvs_commit = cvs commit "$@"
 hg_commit  = hg commit -m "$@" && hg push
 darcs_commit = darcs record -a -m "$@" && darcs push -a

Attachment: signature.asc
Description: Digital signature

Reply via email to