comparison 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
comparison
equal deleted inserted replaced
10249:8ebb34b0f6f7 10251:a19d2993385d
207 207
208 def merge(self, state): 208 def merge(self, state):
209 self._get(state) 209 self._get(state)
210 cur = self._repo['.'] 210 cur = self._repo['.']
211 dst = self._repo[state[1]] 211 dst = self._repo[state[1]]
212 if dst.ancestor(cur) == cur: 212 anc = dst.ancestor(cur)
213 if anc == cur:
213 self._repo.ui.debug("updating subrepo %s\n" % self._path) 214 self._repo.ui.debug("updating subrepo %s\n" % self._path)
214 hg.update(self._repo, state[1]) 215 hg.update(self._repo, state[1])
216 elif anc == dst:
217 self._repo.ui.debug("skipping subrepo %s\n" % self._path)
215 else: 218 else:
216 self._repo.ui.debug("merging subrepo %s\n" % self._path) 219 self._repo.ui.debug("merging subrepo %s\n" % self._path)
217 hg.merge(self._repo, state[1], remind=False) 220 hg.merge(self._repo, state[1], remind=False)
218 221
219 def push(self, force): 222 def push(self, force):