Patchwork D7131: copies: simplify chain loop

login
register
mail settings
Submitter phabricator
Date Oct. 17, 2019, 11:47 p.m.
Message ID <differential-rev-PHID-DREV-zna3p4pz34k5aab54mxd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42467/
State Superseded
Headers show

Comments

phabricator - Oct. 17, 2019, 11:47 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is a mostly gratuitous change to make the code more direct.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7131

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -67,10 +67,7 @@ 
     """chain two sets of copies 'a' and 'b'"""
     t = a.copy()
     for k, v in pycompat.iteritems(b):
-        if v in t:
-            t[k] = t[v]
-        else:
-            t[k] = v
+        t[k] = t.get(v, v)
     return t