[PATCH 09 of 19] commit: refactor subrepo state building into working context

Kevin Bullock kbullock+mercurial at ringworld.org
Sun Feb 10 21:22:11 CST 2013


On 10 Feb 2013, at 11:29 PM, David Schleimer wrote:

> # HG changeset patch
> # User David Schleimer <dschleimer at fb.com>
> # Date 1360330572 28800
> # Node ID 84e89fe78426b02aeb09add9a63a04e1e7459ec0
> # Parent  62d93c48151c79f5e08c3e22b79e52052283ce66
> commit: refactor subrepo state building into working context
> 
> This moves the logic for building a new substate into the working
> context.  In particular, this is the logic that decides which subrepos
> need to be committed before the main commit can proceed, validates
> that we aren't about to commit without including a modified subrepo,
> figures out whether we need to write out a new substate, and builds
> said new substate.
> 
> This is part of a larger refactoring effort that moves logic into the
> working context.  The long-term goal of that refactoring is to unify
> how we commit from the working copy and from memory.  Among other
> things, this will support optimizations in graft, rebase, and similar
> commands.
> 
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1162,6 +1162,44 @@
>             finally:
>                 wlock.release()
> 
> +    def commitablesubstate(self, match, force):
> +        subs = []
> +        commitsubs = set()
> +        newstate = self.substate.copy()
> +        oldstate = self.p1().substate
> +
> +        # compare current state to last committed state
> +        # build new substate based on last committed state

Not sure if method does what it says on the tin. Maybe this is a good time to pull this comment up into a docstring describing this blob of code?

> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1155,10 +1155,8 @@
>             if force:
>                 changes[0].extend(changes[6]) # mq may commit unchanged files
> 
> +            subs = []
>             # check subrepos
> -            subs = []

WAT

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list