[PATCH 3 of 3] subrepo: propagate non-default pull/push path to subrepos (issue1852)

Mads Kiilerich mads at kiilerich.com
Sun Oct 10 15:47:38 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1286743579 18000
# Node ID 135bcea28bd9b284ed0eaae8c21c66601f4956f7
# Parent  283b68ecb1bbc52c3c438f4028276f05acfd0ea6
subrepo: propagate non-default pull/push path to subrepos (issue1852)

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2754,6 +2754,8 @@
     modheads = repo.pull(other, heads=revs, force=opts.get('force'))
     if checkout:
         checkout = str(repo.changelog.rev(other.lookup(checkout)))
+    # repo source path is needed for subrepos with relative paths 
+    ui.setconfig('paths', 'default', source)
     return postincoming(ui, repo, modheads, opts.get('update'), checkout)
 
 def push(ui, repo, dest=None, **opts):
@@ -2793,6 +2795,8 @@
     if revs:
         revs = [repo.lookup(rev) for rev in revs]
 
+    # repo dest path is needed for subrepos with relative paths
+    ui.setconfig('paths', 'default-push', dest)
     # push subrepos depth-first for coherent ordering
     c = repo['']
     subs = c.substate # only repos that are committed
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -617,6 +617,13 @@
   $ hg update
   abort: default path for subrepository sub/repo not found
   [255]
+
+Pulling again won't fix this situation
+
+  $ hg pull -u ../issue1852a
+  pulling from ../issue1852a
+  searching for changes
+  no changes found
   $ cd ..
 
 Try the same, but verify that pull -u works
@@ -630,6 +637,11 @@
   adding manifests
   adding file changes
   added 1 changesets with 2 changes to 2 files
-  abort: default path for subrepository sub/repo not found
-  [255]
+  pulling subrepo sub/repo from $TESTTMP/sub/issue1852a/sub/repo
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd ..


More information about the Mercurial-devel mailing list