Patchwork D7473: localrepo: add some basic comment for block in __getitem__

login
register
mail settings
Submitter phabricator
Date Nov. 23, 2019, 4:06 a.m.
Message ID <b1edd179438638f1b4d9a948c2a79b29@localhost.localdomain>
Download mbox | patch
Permalink /patch/43453/
State Not Applicable
Headers show

Comments

phabricator - Nov. 23, 2019, 4:06 a.m.
Closed by commit rHG7d6465eda585: localrepo: add some basic comment for block in __getitem__ (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7473?vs=18280&id=18325

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7473/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1515,10 +1515,13 @@ 
         self.invalidate(clearfilecache=True)
 
     def __getitem__(self, changeid):
+        # dealing with special cases
         if changeid is None:
             return context.workingctx(self)
         if isinstance(changeid, context.basectx):
             return changeid
+
+        # dealing with multiple revisions
         if isinstance(changeid, slice):
             # wdirrev isn't contiguous so the slice shouldn't include it
             return [
@@ -1526,6 +1529,8 @@ 
                 for i in pycompat.xrange(*changeid.indices(len(self)))
                 if i not in self.changelog.filteredrevs
             ]
+
+        # dealing with arbitrary values
         try:
             if isinstance(changeid, int):
                 node = self.changelog.node(changeid)