Patchwork [46,of,48,RFC] commitablefilectx: move __nonzero__ from workingfilectx

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <2d2d9d92a1d104410d6b.1378411660@laptop.local>
Download mbox | patch
Permalink /patch/2384/
State Accepted
Commit d2936bec530be6f573bad367cd3825e3f6f5d1f8
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:07 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1376590986 18000
#      Thu Aug 15 13:23:06 2013 -0500
# Node ID 2d2d9d92a1d104410d6ba7d29517d7d6f311eecd
# Parent  abc3acd32a7860c73680d15cecf525ec1cca0b8a
commitablefilectx: move __nonzero__ from workingfilectx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1200,23 +1200,23 @@ 
         if filelog is not None:
             self._filelog = filelog
         if ctx:
             self._changectx = ctx
 
+    def __nonzero__(self):
+        return True
+
 class workingfilectx(commitablefilectx):
     """A workingfilectx object makes access to data related to a particular
        file in the working directory convenient."""
     def __init__(self, repo, path, filelog=None, workingctx=None):
         super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
 
     @propertycache
     def _changectx(self):
         return workingctx(self._repo)
 
-    def __nonzero__(self):
-        return True
-
     def data(self):
         return self._repo.wread(self._path)
     def renamed(self):
         rp = self._repo.dirstate.copied(self._path)
         if not rp: