Mercurial > public > mercurial-scm > hg-stable
diff mercurial/copies.py @ 44242:baf3fe2977cc
copies: move early return in mergecopies() earlier
It wasn't obvious that the early return happened only when there are
no copies. That is the case, however, because if `fullcopy` is empty,
then so is `copies1` and `copies2`, and then so is `inversecopies1`
and `inversecopies2`, and then so is `allsources`, and then so is
`copy`, `diverge` and `renamedelete`.
By moving the early return earlier, we also avoid calculating the set
of added files from the base to each side.
Differential Revision: https://phab.mercurial-scm.org/D7975
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 22 Jan 2020 15:20:12 -0800 |
parents | 06e7e7652ac0 |
children | 782e0d9c3b74 |
line wrap: on
line diff
--- a/mercurial/copies.py Fri Jan 24 07:00:45 2020 -0800 +++ b/mercurial/copies.py Wed Jan 22 15:20:12 2020 -0800 @@ -563,6 +563,9 @@ copies1 = pathcopies(base, c1) copies2 = pathcopies(base, c2) + if not (copies1 or copies2): + return {}, {}, {}, {}, {} + inversecopies1 = {} inversecopies2 = {} for dst, src in copies1.items(): @@ -632,8 +635,6 @@ fullcopy = copies1.copy() fullcopy.update(copies2) - if not fullcopy: - return copy, {}, diverge, renamedelete, {} if repo.ui.debugflag: repo.ui.debug(