##// 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 RECORD_UNSUPPORTED_MANDATORY = b'X'
61 RECORD_UNSUPPORTED_MANDATORY = b'X'
62 RECORD_UNSUPPORTED_ADVISORY = b'x'
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 class mergestate(object):
68 class mergestate(object):
65 '''track 3-way merge state of individual files
69 '''track 3-way merge state of individual files
66
70
@@ -147,9 +151,9 b' class mergestate(object):'
147 self._other = other
151 self._other = other
148 self._readmergedriver = None
152 self._readmergedriver = None
149 if self.mergedriver:
153 if self.mergedriver:
150 self._mdstate = 's'
154 self._mdstate = MERGE_DRIVER_STATE_SUCCESS
151 else:
155 else:
152 self._mdstate = 'u'
156 self._mdstate = MERGE_DRIVER_STATE_UNMARKED
153 shutil.rmtree(self._repo.vfs.join('merge'), True)
157 shutil.rmtree(self._repo.vfs.join('merge'), True)
154 self._results = {}
158 self._results = {}
155 self._dirty = False
159 self._dirty = False
@@ -168,7 +172,7 b' class mergestate(object):'
168 if var in vars(self):
172 if var in vars(self):
169 delattr(self, var)
173 delattr(self, var)
170 self._readmergedriver = None
174 self._readmergedriver = None
171 self._mdstate = 's'
175 self._mdstate = MERGE_DRIVER_STATE_SUCCESS
172 unsupported = set()
176 unsupported = set()
173 records = self._readrecords()
177 records = self._readrecords()
174 for rtype, record in records:
178 for rtype, record in records:
@@ -179,9 +183,11 b' class mergestate(object):'
179 elif rtype == RECORD_MERGE_DRIVER_STATE:
183 elif rtype == RECORD_MERGE_DRIVER_STATE:
180 bits = record.split('\0', 1)
184 bits = record.split('\0', 1)
181 mdstate = bits[1]
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 # the merge driver should be idempotent, so just rerun it
189 # the merge driver should be idempotent, so just rerun it
184 mdstate = 'u'
190 mdstate = MERGE_DRIVER_STATE_UNMARKED
185
191
186 self._readmergedriver = bits[0]
192 self._readmergedriver = bits[0]
187 self._mdstate = mdstate
193 self._mdstate = mdstate
@@ -1665,7 +1671,8 b' def applyupdates(repo, actions, wctx, mc'
1665
1671
1666 unresolved = ms.unresolvedcount()
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 if not driverconclude(repo, ms, wctx, labels=labels):
1676 if not driverconclude(repo, ms, wctx, labels=labels):
1670 # XXX setting unresolved to at least 1 is a hack to make sure we
1677 # XXX setting unresolved to at least 1 is a hack to make sure we
1671 # error out
1678 # error out
General Comments 0
You need to be logged in to leave comments. Login now