Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 27035:de7bf242644e
merge.mergestate: compute dirstate action
In upcoming patches we're going to queue these actions up to be applied to the
dirstate at the end.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 19 Nov 2015 10:50:02 -0800 |
parents | 86ede9eda252 |
children | 86290f6f6599 |
comparison
equal
deleted
inserted
replaced
27034:86ede9eda252 | 27035:de7bf242644e |
---|---|
408 yield f | 408 yield f |
409 | 409 |
410 def _resolve(self, preresolve, dfile, wctx, labels=None): | 410 def _resolve(self, preresolve, dfile, wctx, labels=None): |
411 """rerun merge process for file path `dfile`""" | 411 """rerun merge process for file path `dfile`""" |
412 if self[dfile] in 'rd': | 412 if self[dfile] in 'rd': |
413 return True, 0 | 413 return True, 0, None |
414 stateentry = self._state[dfile] | 414 stateentry = self._state[dfile] |
415 state, hash, lfile, afile, anode, ofile, onode, flags = stateentry | 415 state, hash, lfile, afile, anode, ofile, onode, flags = stateentry |
416 octx = self._repo[self._other] | 416 octx = self._repo[self._other] |
417 fcd = wctx[dfile] | 417 fcd = wctx[dfile] |
418 fco = octx[ofile] | 418 fco = octx[ofile] |
443 # no real conflict | 443 # no real conflict |
444 del self._state[dfile] | 444 del self._state[dfile] |
445 self._dirty = True | 445 self._dirty = True |
446 elif not r: | 446 elif not r: |
447 self.mark(dfile, 'r') | 447 self.mark(dfile, 'r') |
448 return complete, r | 448 |
449 action = None | |
450 if complete: | |
451 if deleted: | |
452 if not fcd.isabsent(): | |
453 # cd: remote picked (or otherwise deleted) | |
454 action = 'r' | |
455 # else: dc: local picked (no action necessary) | |
456 else: | |
457 if fcd.isabsent(): # dc: remote picked | |
458 action = 'g' | |
459 elif fco.isabsent(): # cd: local picked | |
460 action = 'a' | |
461 # else: regular merges (no action necessary) | |
462 | |
463 return complete, r, action | |
449 | 464 |
450 def preresolve(self, dfile, wctx, labels=None): | 465 def preresolve(self, dfile, wctx, labels=None): |
451 """run premerge process for dfile | 466 """run premerge process for dfile |
452 | 467 |
453 Returns whether the merge is complete, and the exit code.""" | 468 Returns whether the merge is complete, and the exit code.""" |
454 return self._resolve(True, dfile, wctx, labels=labels) | 469 complete, r, action = self._resolve(True, dfile, wctx, labels=labels) |
470 return complete, r | |
455 | 471 |
456 def resolve(self, dfile, wctx, labels=None): | 472 def resolve(self, dfile, wctx, labels=None): |
457 """run merge process (assuming premerge was run) for dfile | 473 """run merge process (assuming premerge was run) for dfile |
458 | 474 |
459 Returns the exit code of the merge.""" | 475 Returns the exit code of the merge.""" |
460 return self._resolve(False, dfile, wctx, labels=labels)[1] | 476 complete, r, action = self._resolve(False, dfile, wctx, labels=labels) |
477 return r | |
461 | 478 |
462 def _checkunknownfile(repo, wctx, mctx, f, f2=None): | 479 def _checkunknownfile(repo, wctx, mctx, f, f2=None): |
463 if f2 is None: | 480 if f2 is None: |
464 f2 = f | 481 f2 = f |
465 return (os.path.isfile(repo.wjoin(f)) | 482 return (os.path.isfile(repo.wjoin(f)) |