[PATCH 1 of 3 V2] subrepo: allow a representation of the working directory subrepo

Yuya Nishihara yuya at tcha.org
Wed Jun 17 09:43:42 CDT 2015


On Tue, 16 Jun 2015 23:39:22 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1434510216 14400
> #      Tue Jun 16 23:03:36 2015 -0400
> # Node ID ba8fc81a1f23ec0d763aa59f78745d06bb648be2
> # Parent  f1d46075b13a90671c14b2737b1d4f07a3fa1a4a
> subrepo: allow a representation of the working directory subrepo
> 
> Some code cannot handle a subrepo based on the working directory (e.g.
> sub.dirty()), so the caller must opt in.  This will be useful for archive, and
> perhaps some other commands.  The git and svn methods where this is used may
> need to be fixed up on a case by case basis.
> 
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -249,11 +249,18 @@
>              return ''
>  
>      def sub(self, path):
> +        '''return a subrepo for the stored revision of path, never wdir()'''
>          return subrepo.subrepo(self, path)
>  
>      def nullsub(self, path, pctx):
>          return subrepo.nullsubrepo(self, path, pctx)
>  
> +    def workingsub(self, path):
> +        '''return a subrepo for the stored revision, or wdir if this is a wdir
> +        context.
> +        '''
> +        return subrepo.subrepo(self, path, True)

Nitpick. 'allowwdir=True' would be readable here than just 'True'.


More information about the Mercurial-devel mailing list