]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Ignore nonzero exit status of hg pull, which can happen when there were no changes...
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 7147061b2019a93d5e889c3b40ffa6f87d24c17a..cb4ff43b23d97adcb8daf138797adaf9722e37d4 100755 (executable)
--- a/mr
+++ b/mr
@@ -684,6 +684,7 @@ sub fulldir {
 sub action {
        my ($action, $dir, $topdir, $subdir, $force_checkout) = @_;
        my $fulldir=fulldir($topdir, $subdir);
+       my $checkout_dir;
 
        $ENV{MR_CONFIG}=$configfiles{$topdir};
        my $is_checkout=($action eq 'checkout');
@@ -725,6 +726,7 @@ sub action {
        }
 
        if ($is_checkout) {
+               $checkout_dir=$dir;
                if (! $force_checkout) {
                        if (-d $dir) {
                                print "mr $action: $dir already exists, skipping checkout\n" if $verbose;
@@ -828,7 +830,13 @@ sub action {
                        my $ret=hook("post_$action", $topdir, $subdir);
                        return $ret if $ret != OK;
                        
-                       if (($is_checkout || $is_update)) {
+                       if ($is_checkout || $is_update) {
+                               if ($is_checkout && ! $no_chdir) {
+                                       if (! chdir($checkout_dir)) {
+                                               print STDERR "mr $action: failed to chdir to $checkout_dir: $!\n";
+                                               return FAILED;
+                                       }
+                               }
                                my $ret=hook("fixups", $topdir, $subdir);
                                return $ret if $ret != OK;
                        }
@@ -1883,7 +1891,7 @@ bzr_update =
                bzr merge --pull "$@"
        fi
 cvs_update = cvs update "$@"
-hg_update  = hg pull "$@" && hg update "$@"
+hg_update  = hg pull "$@"; hg update "$@"
 darcs_update = darcs pull -a "$@"
 fossil_update = fossil pull "$@"
 vcsh_update = vcsh run "$MR_REPO" git pull "$@"