Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 27183:0945539a3a6b
extdiff: correctly handle deleted subrepositories (issue3153)
Previously, when extdiff was called on two changesets where
a subrepository had been removed, an unexpected KeyError would
be raised.
Now, the missing subrepository will be ignored. This behavior
mirrors the behavior in diffordiffstat from cmdutil.py line
~1138-1153. The KeyError is caught and the revision is
set to None.
try/catch of LookupError around matchmod.narrowmatcher and
sub.status is removed, as LookupError is not raised anywhere
within those methods or deeper calls.
author | Andrew Zwicky <andrew.zwicky@gmail.com> |
---|---|
date | Tue, 17 Nov 2015 16:42:52 -0600 |
parents | a29db426c5ba |
children | 15c6eb0a51bd |
comparison
equal
deleted
inserted
replaced
27182:71aa5a26162d | 27183:0945539a3a6b |
---|---|
334 r = scmutil.status(r.modified, r.removed, r.added, [], [], [], | 334 r = scmutil.status(r.modified, r.removed, r.added, [], [], [], |
335 r.clean) | 335 r.clean) |
336 | 336 |
337 if listsubrepos: | 337 if listsubrepos: |
338 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): | 338 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
339 rev2 = ctx2.subrev(subpath) | |
340 try: | 339 try: |
341 submatch = matchmod.narrowmatcher(subpath, match) | 340 rev2 = ctx2.subrev(subpath) |
342 s = sub.status(rev2, match=submatch, ignored=listignored, | 341 except KeyError: |
343 clean=listclean, unknown=listunknown, | 342 # A subrepo that existed in node1 was deleted between |
344 listsubrepos=True) | 343 # node1 and node2 (inclusive). Thus, ctx2's substate |
345 for rfiles, sfiles in zip(r, s): | 344 # won't contain that subpath. The best we can do ignore it. |
346 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) | 345 rev2 = None |
347 except error.LookupError: | 346 submatch = matchmod.narrowmatcher(subpath, match) |
348 self._repo.ui.status(_("skipping missing " | 347 s = sub.status(rev2, match=submatch, ignored=listignored, |
349 "subrepository: %s\n") % subpath) | 348 clean=listclean, unknown=listunknown, |
349 listsubrepos=True) | |
350 for rfiles, sfiles in zip(r, s): | |
351 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) | |
350 | 352 |
351 for l in r: | 353 for l in r: |
352 l.sort() | 354 l.sort() |
353 | 355 |
354 return r | 356 return r |