Mercurial > hg
comparison hgext/largefiles/overrides.py @ 45282:b442920ab1de
merge: introduce mergeresult.addfile() and use it
We want to use mergeresult object at more and more places instead of this
actions dict to simplify code and further add new APIs to mergeresult object.
This patch introduces `addfile()` which adds a new file to the internal actions
dict for now.
Differential Revision: https://phab.mercurial-scm.org/D8820
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 24 Jul 2020 16:18:39 +0530 |
parents | 0e18861f96ab |
children | ab57793dec5b |
comparison
equal
deleted
inserted
replaced
45281:fe2040abb183 | 45282:b442920ab1de |
---|---|
576 b'$$ &Largefile $$ &Normal file' | 576 b'$$ &Largefile $$ &Normal file' |
577 ) | 577 ) |
578 % lfile | 578 % lfile |
579 ) | 579 ) |
580 if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile | 580 if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile |
581 mresult.actions[lfile] = (b'r', None, b'replaced by standin') | 581 mresult.addfile(lfile, b'r', None, b'replaced by standin') |
582 mresult.actions[standin] = (b'g', sargs, b'replaces standin') | 582 mresult.addfile(standin, b'g', sargs, b'replaces standin') |
583 else: # keep local normal file | 583 else: # keep local normal file |
584 mresult.actions[lfile] = (b'k', None, b'replaces standin') | 584 mresult.addfile(lfile, b'k', None, b'replaces standin') |
585 if branchmerge: | 585 if branchmerge: |
586 mresult.actions[standin] = ( | 586 mresult.addfile( |
587 b'k', | 587 standin, b'k', None, b'replaced by non-standin', |
588 None, | |
589 b'replaced by non-standin', | |
590 ) | 588 ) |
591 else: | 589 else: |
592 mresult.actions[standin] = ( | 590 mresult.addfile( |
593 b'r', | 591 standin, b'r', None, b'replaced by non-standin', |
594 None, | |
595 b'replaced by non-standin', | |
596 ) | 592 ) |
597 elif lm in (b'g', b'dc') and sm != b'r': | 593 elif lm in (b'g', b'dc') and sm != b'r': |
598 if lm == b'dc': | 594 if lm == b'dc': |
599 f1, f2, fa, move, anc = largs | 595 f1, f2, fa, move, anc = largs |
600 largs = (p2[f2].flags(), False) | 596 largs = (p2[f2].flags(), False) |
609 % lfile | 605 % lfile |
610 ) | 606 ) |
611 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile | 607 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile |
612 if branchmerge: | 608 if branchmerge: |
613 # largefile can be restored from standin safely | 609 # largefile can be restored from standin safely |
614 mresult.actions[lfile] = ( | 610 mresult.addfile( |
615 b'k', | 611 lfile, b'k', None, b'replaced by standin', |
616 None, | |
617 b'replaced by standin', | |
618 ) | 612 ) |
619 mresult.actions[standin] = (b'k', None, b'replaces standin') | 613 mresult.addfile(standin, b'k', None, b'replaces standin') |
620 else: | 614 else: |
621 # "lfile" should be marked as "removed" without | 615 # "lfile" should be marked as "removed" without |
622 # removal of itself | 616 # removal of itself |
623 mresult.actions[lfile] = ( | 617 mresult.addfile( |
624 b'lfmr', | 618 lfile, b'lfmr', None, b'forget non-standin largefile', |
625 None, | |
626 b'forget non-standin largefile', | |
627 ) | 619 ) |
628 | 620 |
629 # linear-merge should treat this largefile as 're-added' | 621 # linear-merge should treat this largefile as 're-added' |
630 mresult.actions[standin] = (b'a', None, b'keep standin') | 622 mresult.addfile(standin, b'a', None, b'keep standin') |
631 else: # pick remote normal file | 623 else: # pick remote normal file |
632 mresult.actions[lfile] = (b'g', largs, b'replaces standin') | 624 mresult.addfile(lfile, b'g', largs, b'replaces standin') |
633 mresult.actions[standin] = ( | 625 mresult.addfile( |
634 b'r', | 626 standin, b'r', None, b'replaced by non-standin', |
635 None, | |
636 b'replaced by non-standin', | |
637 ) | 627 ) |
638 | 628 |
639 return mresult | 629 return mresult |
640 | 630 |
641 | 631 |