]> 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:

bzr record --local for checkout
[code/myrepos.git] / mr
diff --git a/mr b/mr
index bd6c2d73d90656a332ec9f12acd6d1d47a1fd036..340489cd2a745189d27385e12f512b734dd43d9f 100755 (executable)
--- a/mr
+++ b/mr
@@ -1059,7 +1059,7 @@ sub is_trusted_checkout {
                                        is_trusted_repo($words[$c])
                                );
                        }
-                       elsif (defined $words[$c] && $twords[$c] eq $words[$c]) {
+                       elsif (defined $words[$c] && $words[$c]=~/^($twords[$c])$/) {
                                $match=1;
                        }
                        else {
@@ -1184,13 +1184,23 @@ sub loadconfig {
                        }
 
                        if (! $trusted) {
-                               # Untrusted files can only contain checkout
-                               # parameters.
-                               if ($parameter ne 'checkout') {
-                                       trusterror("mr: illegal setting \"$parameter=$value\"", $f, $line, $bootstrap_url);
+                               # Untrusted files can only contain a few
+                               # settings in specific known-safe formats.
+                               if ($parameter eq 'checkout') {
+                                       if (! is_trusted_checkout($value)) {
+                                               trusterror("mr: illegal checkout command \"$value\"", $f, $line, $bootstrap_url);
+                                       }
                                }
-                               if (! is_trusted_checkout($value)) {
-                                       trusterror("mr: illegal checkout command \"$value\"", $f, $line, $bootstrap_url);
+                               elsif ($parameter eq 'order') {
+                                       # not interpreted as a command, so
+                                       # safe.
+                               }
+                               elsif ($value eq 'true' || $value eq 'false') {
+                                       # skip=true , deleted=true etc are
+                                       # safe.
+                               }
+                               else {
+                                       trusterror("mr: illegal setting \"$parameter=$value\"", $f, $line, $bootstrap_url);
                                }
                        }
 
@@ -1678,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
@@ -1693,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 "$@"
@@ -1709,14 +1727,24 @@ 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
 fossil_commit = fossil commit "$@"
 
 git_record = git commit -a "$@"
-bzr_record = bzr commit "$@"
+bzr_record =
+       if is_bzr_checkout; then
+               bzr commit --local "$@"
+       else
+               bzr commit "$@"
+       fi
 hg_record  = hg commit -m "$@"
 darcs_record = darcs record -a -m "$@"
 fossil_record = fossil commit "$@"
@@ -1768,7 +1796,7 @@ bzr_register =
                error "cannot determine bzr url"
        fi
        echo "Registering bzr url: $url in $MR_CONFIG"
-       mr -c "$MR_CONFIG" config "`pwd`" checkout="bzr clone '$url' '$MR_REPO'"
+       mr -c "$MR_CONFIG" config "`pwd`" checkout="bzr branch '$url' '$MR_REPO'"
 cvs_register =
        repo=`cat CVS/Repository`
        root=`cat CVS/Root`
@@ -1801,7 +1829,7 @@ fossil_register =
 svn_trusted_checkout = svn co $url $repo
 svn_alt_trusted_checkout = svn checkout $url $repo
 git_trusted_checkout = git clone $url $repo
-bzr_trusted_checkout = bzr clone $url $repo
+bzr_trusted_checkout = bzr checkout|clone|branch|get $url $repo
 # cvs: too hard
 hg_trusted_checkout = hg clone $url $repo
 darcs_trusted_checkout = darcs get $url $repo