diff mercurial/commands.py @ 12852:5dbff89cf107 stable

subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 27 Oct 2010 00:28:40 +0200
parents 4d657b524be8
children 60d9692921ea
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Oct 26 14:41:58 2010 +0300
+++ b/mercurial/commands.py	Wed Oct 27 00:28:40 2010 +0200
@@ -2784,7 +2784,11 @@
     modheads = repo.pull(other, heads=revs, force=opts.get('force'))
     if checkout:
         checkout = str(repo.changelog.rev(other.lookup(checkout)))
-    return postincoming(ui, repo, modheads, opts.get('update'), checkout)
+    repo._subtoppath = source
+    try:
+        return postincoming(ui, repo, modheads, opts.get('update'), checkout)
+    finally:
+        del repo._subtoppath
 
 def push(ui, repo, dest=None, **opts):
     """push changes to the specified destination
@@ -2823,13 +2827,16 @@
     if revs:
         revs = [repo.lookup(rev) for rev in revs]
 
-    # push subrepos depth-first for coherent ordering
-    c = repo['']
-    subs = c.substate # only repos that are committed
-    for s in sorted(subs):
-        if not c.sub(s).push(opts.get('force')):
-            return False
-
+    repo._subtoppath = dest
+    try:
+        # push subrepos depth-first for coherent ordering
+        c = repo['']
+        subs = c.substate # only repos that are committed
+        for s in sorted(subs):
+            if not c.sub(s).push(opts.get('force')):
+                return False
+    finally:
+        del repo._subtoppath
     r = repo.push(other, opts.get('force'), revs=revs,
                   newbranch=opts.get('new_branch'))
     return r == 0