diff mercurial/subrepo.py @ 10251:a19d2993385d stable

subrepo: fix merging of already merged subrepos (issue1986) This fixes a bug seen when merging a main repo which contains a subrepo when both repos have been merged before. Each repo (main and sub) has two branches, both of which have been merged before. In a subrepo, if the revision to merge to is an ancestor of the current rev, then the merge should be a noop. Test provided by Steve Losh.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 15 Jan 2010 21:08:04 +0100
parents 8f14f749f471
children 0bc93fa2cf2b 25e572394f5c
line wrap: on
line diff
--- a/mercurial/subrepo.py	Fri Jan 15 09:50:52 2010 +0100
+++ b/mercurial/subrepo.py	Fri Jan 15 21:08:04 2010 +0100
@@ -209,9 +209,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)