Patchwork [3,of,3,ctx-cleanup] context: move dirty() to committablectx

login
register
mail settings
Submitter Sean Farley
Date June 1, 2017, 12:22 a.m.
Message ID <b260e8ec9b2b0b1ba4d0.1496276528@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21107/
State Accepted
Headers show

Comments

Sean Farley - June 1, 2017, 12:22 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1494536388 25200
#      Thu May 11 13:59:48 2017 -0700
# Branch wctxds
# Node ID b260e8ec9b2b0b1ba4d0ccf6b823c3a2b5d449b9
# Parent  6cdb17d89848a1bdb0fbcac24fe8c8322bb0bb02
context: move dirty() to committablectx

This is a pedantic move. It should be an error if dirty() is called on a
read-only context. Based on Mads Kiilerix's and my work at the sprint.
Augie Fackler - June 1, 2017, 2:23 p.m.
On Wed, May 31, 2017 at 05:22:08PM -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean@farley.io>
> # Date 1494536388 25200
> #      Thu May 11 13:59:48 2017 -0700
> # Branch wctxds
> # Node ID b260e8ec9b2b0b1ba4d0ccf6b823c3a2b5d449b9
> # Parent  6cdb17d89848a1bdb0fbcac24fe8c8322bb0bb02
> context: move dirty() to committablectx

Queued these, thanks.

>
> This is a pedantic move. It should be an error if dirty() is called on a
> read-only context. Based on Mads Kiilerix's and my work at the sprint.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> index af1a4ec..30e3603 100644
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -321,13 +321,10 @@ class basectx(object):
>          return self._manifest.dirs()
>
>      def hasdir(self, dir):
>          return self._manifest.hasdir(dir)
>
> -    def dirty(self, missing=False, merge=True, branch=True):
> -        return False
> -
>      def status(self, other=None, match=None, listignored=False,
>                 listclean=False, listunknown=False, listsubrepos=False):
>          """return status of files between two nodes or node and working
>          directory.
>
> @@ -1549,10 +1546,13 @@ class committablectx(basectx):
>          # write changes out explicitly, because nesting wlock at
>          # runtime may prevent 'wlock.release()' in 'repo.commit()'
>          # from immediately doing so for subsequent changing files
>          self._repo.dirstate.write(self._repo.currenttransaction())
>
> +    def dirty(self, missing=False, merge=True, branch=True):
> +        return False
> +
>  class workingctx(committablectx):
>      """A workingctx object makes access to data related to
>      the current working directory convenient.
>      date - any valid date string or (unixtime, offset), or None.
>      user - username string, or None.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
index af1a4ec..30e3603 100644
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -321,13 +321,10 @@  class basectx(object):
         return self._manifest.dirs()
 
     def hasdir(self, dir):
         return self._manifest.hasdir(dir)
 
-    def dirty(self, missing=False, merge=True, branch=True):
-        return False
-
     def status(self, other=None, match=None, listignored=False,
                listclean=False, listunknown=False, listsubrepos=False):
         """return status of files between two nodes or node and working
         directory.
 
@@ -1549,10 +1546,13 @@  class committablectx(basectx):
         # write changes out explicitly, because nesting wlock at
         # runtime may prevent 'wlock.release()' in 'repo.commit()'
         # from immediately doing so for subsequent changing files
         self._repo.dirstate.write(self._repo.currenttransaction())
 
+    def dirty(self, missing=False, merge=True, branch=True):
+        return False
+
 class workingctx(committablectx):
     """A workingctx object makes access to data related to
     the current working directory convenient.
     date - any valid date string or (unixtime, offset), or None.
     user - username string, or None.