##// END OF EJS Templates
merge: use constants for merge driver state...
Gregory Szorc -
r37128:1b158ca3 default
parent child Browse files
Show More
@@ -61,6 +61,10 b" RECORD_OVERRIDE = b't'"
61 61 RECORD_UNSUPPORTED_MANDATORY = b'X'
62 62 RECORD_UNSUPPORTED_ADVISORY = b'x'
63 63
64 MERGE_DRIVER_STATE_UNMARKED = b'u'
65 MERGE_DRIVER_STATE_MARKED = b'm'
66 MERGE_DRIVER_STATE_SUCCESS = b's'
67
64 68 class mergestate(object):
65 69 '''track 3-way merge state of individual files
66 70
@@ -147,9 +151,9 b' class mergestate(object):'
147 151 self._other = other
148 152 self._readmergedriver = None
149 153 if self.mergedriver:
150 self._mdstate = 's'
154 self._mdstate = MERGE_DRIVER_STATE_SUCCESS
151 155 else:
152 self._mdstate = 'u'
156 self._mdstate = MERGE_DRIVER_STATE_UNMARKED
153 157 shutil.rmtree(self._repo.vfs.join('merge'), True)
154 158 self._results = {}
155 159 self._dirty = False
@@ -168,7 +172,7 b' class mergestate(object):'
168 172 if var in vars(self):
169 173 delattr(self, var)
170 174 self._readmergedriver = None
171 self._mdstate = 's'
175 self._mdstate = MERGE_DRIVER_STATE_SUCCESS
172 176 unsupported = set()
173 177 records = self._readrecords()
174 178 for rtype, record in records:
@@ -179,9 +183,11 b' class mergestate(object):'
179 183 elif rtype == RECORD_MERGE_DRIVER_STATE:
180 184 bits = record.split('\0', 1)
181 185 mdstate = bits[1]
182 if len(mdstate) != 1 or mdstate not in 'ums':
186 if len(mdstate) != 1 or mdstate not in (
187 MERGE_DRIVER_STATE_UNMARKED, MERGE_DRIVER_STATE_MARKED,
188 MERGE_DRIVER_STATE_SUCCESS):
183 189 # the merge driver should be idempotent, so just rerun it
184 mdstate = 'u'
190 mdstate = MERGE_DRIVER_STATE_UNMARKED
185 191
186 192 self._readmergedriver = bits[0]
187 193 self._mdstate = mdstate
@@ -1665,7 +1671,8 b' def applyupdates(repo, actions, wctx, mc'
1665 1671
1666 1672 unresolved = ms.unresolvedcount()
1667 1673
1668 if usemergedriver and not unresolved and ms.mdstate() != 's':
1674 if (usemergedriver and not unresolved
1675 and ms.mdstate() != MERGE_DRIVER_STATE_SUCCESS):
1669 1676 if not driverconclude(repo, ms, wctx, labels=labels):
1670 1677 # XXX setting unresolved to at least 1 is a hack to make sure we
1671 1678 # error out
General Comments 0
You need to be logged in to leave comments. Login now