Patchwork D3077: simplestorerepo: avoid shadowing dict in list comprehension over dict

login
register
mail settings
Submitter phabricator
Date April 4, 2018, 7:05 p.m.
Message ID <differential-rev-PHID-DREV-sdbfmv64iiidq6pejkpx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30279/
State Superseded
Headers show

Comments

phabricator - April 4, 2018, 7:05 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by pyflakes.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/simplestorerepo.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - April 4, 2018, 7:13 p.m.
pulkit added inline comments.

INLINE COMMENTS

> simplestorerepo.py:488
>              ishead[self.rev(entry[b'p1'])] = False
>              ishead[self.rev(entry[b'p2'])] = False
>  

Looks like the above two also occurrences of ishead also needs to be replaced by revishead?

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -480,14 +480,14 @@ 
 
     def headrevs(self):
         # Assume all revisions are heads by default.
-        ishead = {rev: True for rev in self._indexbyrev}
+        revishead = {rev: True for rev in self._indexbyrev}
 
         for rev, entry in self._indexbyrev.items():
             # Unset head flag for all seen parents.
             ishead[self.rev(entry[b'p1'])] = False
             ishead[self.rev(entry[b'p2'])] = False
 
-        return [rev for rev, ishead in sorted(ishead.items())
+        return [rev for rev, ishead in sorted(revishead.items())
                 if ishead]
 
     def heads(self, start=None, stop=None):