Patchwork D8177: hgit: fix some issues spotted by pylint integration with editor

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2020, 1:48 p.m.
Message ID <e65a73ff8263be5389838cf44b879777@localhost.localdomain>
Download mbox | patch
Permalink /patch/45380/
State Not Applicable
Headers show

Comments

phabricator - Feb. 28, 2020, 1:48 p.m.
pulkit retitled this revision from "hgit: fix self.gitrepo -> self._git_repo" to "hgit: fix some issues spotted by pylint integration with editor".
pulkit updated this revision to Diff 20374.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8177?vs=20372&id=20374

BRANCH
  default

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

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

AFFECTED FILES
  hgext/git/dirstate.py
  hgext/git/manifest.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py
--- a/hgext/git/manifest.py
+++ b/hgext/git/manifest.py
@@ -62,7 +62,7 @@ 
         comps = upath.split('/')
         for comp in comps[:-1]:
             te = self._tree[comp]
-            t = self.gitrepo[te.id]
+            t = self._git_repo[te.id]
         ent = t[comps[-1]]
         if ent.filemode == pygit2.GIT_FILEMODE_BLOB:
             flags = b''
@@ -81,7 +81,7 @@ 
         return self._resolve_entry(path)
 
     def __len__(self):
-        return len(list(self.walk()))
+        return len(list(self.walk(matchmod.always())))
 
     def __nonzero__(self):
         try:
@@ -91,7 +91,7 @@ 
             return False
 
     def __bool__(self):
-        return self.__nonzero__(self)
+        return self.__nonzero__()
 
     def __contains__(self, path):
         try:
@@ -175,7 +175,7 @@ 
             realname = subdir + pycompat.fsencode(te.name)
             if te.type == r'tree':
                 for inner in self._walkonetree(
-                    self.gitrepo[te.id], match, realname + b'/'
+                    self._git_repo[te.id], match, realname + b'/'
                 ):
                     yield inner
             if not match(realname):
diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -86,8 +86,8 @@ 
 
     @util.propertycache
     def identity(self):
-        self.identity = util.filestat.frompath(
-            os.path.join(self.root, b'.git', b'index')
+        return util.filestat.frompath(
+            os.path.join(self._root, b'.git', b'index')
         )
 
     def branch(self):