mercurial/context.py
changeset 52452 9d79ffeed7c0
parent 51859 f4733654f144
child 52640 24ee91ba9aa8
equal deleted inserted replaced
52451:f5d134e57f51 52452:9d79ffeed7c0
    35     subrepo,
    35     subrepo,
    36     subrepoutil,
    36     subrepoutil,
    37     testing,
    37     testing,
    38     util,
    38     util,
    39 )
    39 )
       
    40 from .interfaces import (
       
    41     status as istatus,
       
    42 )
    40 from .utils import (
    43 from .utils import (
    41     dateutil,
    44     dateutil,
    42     stringutil,
    45     stringutil,
    43 )
    46 )
    44 from .dirstateutils import (
    47 from .dirstateutils import (
    97         """
   100         """
    98         return match
   101         return match
    99 
   102 
   100     def _buildstatus(
   103     def _buildstatus(
   101         self, other, s, match, listignored, listclean, listunknown
   104         self, other, s, match, listignored, listclean, listunknown
   102     ):
   105     ) -> istatus.Status:
   103         """build a status with respect to another context"""
   106         """build a status with respect to another context"""
   104         # Load earliest manifest first for caching reasons. More specifically,
   107         # Load earliest manifest first for caching reasons. More specifically,
   105         # if you have revisions 1000 and 1001, 1001 is probably stored as a
   108         # if you have revisions 1000 and 1001, 1001 is probably stored as a
   106         # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
   109         # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
   107         # 1000 and cache it so that when you read 1001, we just need to apply a
   110         # 1000 and cache it so that when you read 1001, we just need to apply a
   386         match=None,
   389         match=None,
   387         listignored=False,
   390         listignored=False,
   388         listclean=False,
   391         listclean=False,
   389         listunknown=False,
   392         listunknown=False,
   390         listsubrepos=False,
   393         listsubrepos=False,
   391     ):
   394     ) -> istatus.Status:
   392         """return status of files between two nodes or node and working
   395         """return status of files between two nodes or node and working
   393         directory.
   396         directory.
   394 
   397 
   395         If other is None, compare this node with working directory.
   398         If other is None, compare this node with working directory.
   396 
   399 
  1903                 dirstate.invalidate()
  1906                 dirstate.invalidate()
  1904             finally:
  1907             finally:
  1905                 # Even if the wlock couldn't be grabbed, clear out the list.
  1908                 # Even if the wlock couldn't be grabbed, clear out the list.
  1906                 self._repo.clearpostdsstatus()
  1909                 self._repo.clearpostdsstatus()
  1907 
  1910 
  1908     def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
  1911     def _dirstatestatus(
       
  1912         self, match, ignored=False, clean=False, unknown=False
       
  1913     ) -> istatus.Status:
  1909         '''Gets the status from the dirstate -- internal use only.'''
  1914         '''Gets the status from the dirstate -- internal use only.'''
  1910         subrepos = []
  1915         subrepos = []
  1911         if b'.hgsub' in self:
  1916         if b'.hgsub' in self:
  1912             subrepos = sorted(self.substate)
  1917             subrepos = sorted(self.substate)
  1913         dirstate = self._repo.dirstate
  1918         dirstate = self._repo.dirstate
  2727     ):
  2732     ):
  2728         super(workingcommitctx, self).__init__(
  2733         super(workingcommitctx, self).__init__(
  2729             repo, text, user, date, extra, changes
  2734             repo, text, user, date, extra, changes
  2730         )
  2735         )
  2731 
  2736 
  2732     def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
  2737     def _dirstatestatus(
       
  2738         self, match, ignored=False, clean=False, unknown=False
       
  2739     ) -> istatus.Status:
  2733         """Return matched files only in ``self._status``
  2740         """Return matched files only in ``self._status``
  2734 
  2741 
  2735         Uncommitted files appear "clean" via this context, even if
  2742         Uncommitted files appear "clean" via this context, even if
  2736         they aren't actually so in the working directory.
  2743         they aren't actually so in the working directory.
  2737         """
  2744         """
  2922                 del man[f]
  2929                 del man[f]
  2923 
  2930 
  2924         return man
  2931         return man
  2925 
  2932 
  2926     @propertycache
  2933     @propertycache
  2927     def _status(self):
  2934     def _status(self) -> istatus.Status:
  2928         """Calculate exact status from ``files`` specified at construction"""
  2935         """Calculate exact status from ``files`` specified at construction"""
  2929         man1 = self.p1().manifest()
  2936         man1 = self.p1().manifest()
  2930         p2 = self._parents[1]
  2937         p2 = self._parents[1]
  2931         # "1 < len(self._parents)" can't be used for checking
  2938         # "1 < len(self._parents)" can't be used for checking
  2932         # existence of the 2nd parent, because "memctx._parents" is
  2939         # existence of the 2nd parent, because "memctx._parents" is
  3087     @property
  3094     @property
  3088     def _manifest(self):
  3095     def _manifest(self):
  3089         return self._originalctx.manifest()
  3096         return self._originalctx.manifest()
  3090 
  3097 
  3091     @propertycache
  3098     @propertycache
  3092     def _status(self):
  3099     def _status(self) -> istatus.Status:
  3093         """Calculate exact status from ``files`` specified in the ``origctx``
  3100         """Calculate exact status from ``files`` specified in the ``origctx``
  3094         and parents manifests.
  3101         and parents manifests.
  3095         """
  3102         """
  3096         man1 = self.p1().manifest()
  3103         man1 = self.p1().manifest()
  3097         p2 = self._parents[1]
  3104         p2 = self._parents[1]