Mercurial > hg
changeset 26987:416b2b7d3068
mergestate: add a constructor that sets up a clean merge state
Eventually, we'll move the read call out of the constructor. This will:
- avoid unnecessary reads when we're going to nuke the merge state anyway
- avoid raising an exception if there's an unsupported merge record
'clean' seems like a good name for it because I wanted to avoid anything with
the word 'new' in it, and 'reset' is more an action performed on a merge state
than a way to get a new merge state.
Thanks to Martin von Zweigbergk for feedback about naming this.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 17 Nov 2015 17:00:54 -0800 |
parents | 1ee5e48f09d4 |
children | 7e38d49bc713 |
files | mercurial/merge.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Nov 17 14:11:52 2015 -0800 +++ b/mercurial/merge.py Tue Nov 17 17:00:54 2015 -0800 @@ -75,6 +75,14 @@ statepathv1 = 'merge/state' statepathv2 = 'merge/state2' + @staticmethod + def clean(repo, node=None, other=None): + """Initialize a brand new merge state, removing any existing state on + disk.""" + ms = mergestate(repo) + ms.reset(node, other) + return ms + def __init__(self, repo): self._repo = repo self._dirty = False