Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 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 | 11b1832db8ae |
comparison
equal
deleted
inserted
replaced
26986:1ee5e48f09d4 | 26987:416b2b7d3068 |
---|---|
72 m: driver-resolved files marked -- only needs to be run before commit | 72 m: driver-resolved files marked -- only needs to be run before commit |
73 s: success/skipped -- does not need to be run any more | 73 s: success/skipped -- does not need to be run any more |
74 ''' | 74 ''' |
75 statepathv1 = 'merge/state' | 75 statepathv1 = 'merge/state' |
76 statepathv2 = 'merge/state2' | 76 statepathv2 = 'merge/state2' |
77 | |
78 @staticmethod | |
79 def clean(repo, node=None, other=None): | |
80 """Initialize a brand new merge state, removing any existing state on | |
81 disk.""" | |
82 ms = mergestate(repo) | |
83 ms.reset(node, other) | |
84 return ms | |
77 | 85 |
78 def __init__(self, repo): | 86 def __init__(self, repo): |
79 self._repo = repo | 87 self._repo = repo |
80 self._dirty = False | 88 self._dirty = False |
81 self._read() | 89 self._read() |