merge with stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 15 Jan 2010 21:32:53 +0100
changeset 10252 0bc93fa2cf2b
parent 10250 af24805aa37c (current diff)
parent 10251 a19d2993385d (diff)
child 10254 8d5de52431f2
merge with stable
mercurial/subrepo.py
tests/test-subrepo
tests/test-subrepo.out
--- a/mercurial/subrepo.py	Fri Jan 15 10:38:11 2010 +0100
+++ b/mercurial/subrepo.py	Fri Jan 15 21:32:53 2010 +0100
@@ -231,9 +231,12 @@
         self._get(state)
         cur = self._repo['.']
         dst = self._repo[state[1]]
-        if dst.ancestor(cur) == cur:
+        anc = dst.ancestor(cur)
+        if anc == cur:
             self._repo.ui.debug("updating subrepo %s\n" % self._path)
             hg.update(self._repo, state[1])
+        elif anc == dst:
+            self._repo.ui.debug("skipping subrepo %s\n" % self._path)
         else:
             self._repo.ui.debug("merging subrepo %s\n" % self._path)
             hg.merge(self._repo, state[1], remind=False)
--- a/tests/test-subrepo	Fri Jan 15 10:38:11 2010 +0100
+++ b/tests/test-subrepo	Fri Jan 15 21:32:53 2010 +0100
@@ -109,4 +109,56 @@
 echo 'bogus=[boguspath' >> .hgsub
 hg ci -m 'bogus subrepo path'
 
+echo % issue 1986
+cd ..
+rm -rf sub
+hg init main
+cd main
+
+hg init s           # subrepo layout
+cd s                #
+echo a > a          #   o   5 br
+hg ci -Am1          #  /|
+hg branch br        # o |   4 default
+echo a >> a         # | |
+hg ci -m1           # | o   3 br
+hg up default       # |/|
+echo b > b          # o |   2 default
+hg ci -Am1          # | |
+hg up br            # | o   1 br
+hg merge tip        # |/
+hg ci -m1           # o     0 default
+hg up 2
+echo c > c
+hg ci -Am1
+hg up 3
+hg merge 4
+hg ci -m1
+
+cd ..                         # main repo layout:
+echo 's = s' > .hgsub         #
+hg -R s up 2                  #   * <-- try to merge default into br again
+hg ci -Am1                    # .`|
+hg branch br                  # . o   5 br      --> substate = 5
+echo b > b                    # . |
+hg -R s up 3                  # o |   4 default --> substate = 4
+hg ci -Am1                    # | |
+hg up default                 # | o   3 br      --> substate = 2
+echo c > c                    # |/|
+hg ci -Am1                    # o |   2 default --> substate = 2
+hg up 1                       # | |     
+hg merge 2                    # | o   1 br      --> substate = 3
+hg ci -m1                     # |/    
+hg up 2                       # o     0 default --> substate = 2
+hg -R s up 4
+echo d > d
+hg ci -Am1
+hg up 3
+hg -R s up 5
+echo e > e
+hg ci -Am1
+
+hg up 5
+hg merge 4    # try to merge default into br again
+
 exit 0
--- a/tests/test-subrepo.out	Fri Jan 15 10:38:11 2010 +0100
+++ b/tests/test-subrepo.out	Fri Jan 15 21:32:53 2010 +0100
@@ -203,3 +203,43 @@
 blah
 % bogus subrepo path aborts
 abort: missing ] in subrepo source
+% issue 1986
+adding a
+marked working directory as branch br
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding b
+created new head
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding c
+created new head
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+adding .hgsub
+committing subrepository s
+marked working directory as branch br
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding b
+committing subrepository s
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+adding c
+created new head
+2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding d
+committing subrepository s
+created new head
+2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding e
+committing subrepository s
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)