[PATCH 04 of 19] commit: refactor mergestate management into workingctx
Kevin Bullock
kbullock+mercurial at ringworld.org
Sun Feb 10 21:12:21 CST 2013
On 10 Feb 2013, at 11:29 PM, David Schleimer wrote:
> # HG changeset patch
> # User David Schleimer <dschleimer at fb.com>
> # Date 1360330569 28800
> # Node ID f5a6e68310f238e490c6157cf2e4c9725baa1691
> # Parent ae3daa803078b08571d1ad602d5d32c92e15475d
> commit: refactor mergestate management into workingctx
>
> This pulls the logic around validating that there are no unresolved
> conflicts at commit time into the workingctx. It also pulls the state
> necessary for that detection, and the post-cleanup logic for that
> state into the workingcontext object.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -10,6 +10,7 @@
> import ancestor, mdiff, error, util, scmutil, subrepo, patch, encoding, phases
> import copies
> import match as matchmod
> +import merge as mergemod
> import os, errno, stat
> import obsolete as obsmod
> import repoview
> @@ -816,10 +817,16 @@
> self._unknown = changes[4]
> self._ignored = changes[5]
> self._clean = changes[6]
> +
> + self._ms = mergemod.mergestate(self._repo)
> + self._unresolved = [f for f in changes[0]
> + if f in self._ms and self._ms[f] == 'u']
> else:
> self._unknown = None
> self._ignored = None
> self._clean = None
> + self._ms = None
> + self._unresolved = None
>
> self._extra = {}
> if extra:
> @@ -952,6 +959,11 @@
> if clean:
> self._clean = stat[6]
> self._status = stat[:4]
> +
> + self._ms = mergemod.mergestate(self._repo)
> + self._unresolved = [f for f in stat[0]
> + if f in self._ms and self._ms[f] == 'u']
Non-trivial duplicate code, can a brother get a helper function?
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list