Mercurial > hg
comparison hgext/largefiles/overrides.py @ 45942:89a2afe31e82
formating: upgrade to black 20.8b1
This required a couple of small tweaks to un-confuse black, but now it
works. Big formatting changes come from:
* Dramatically improved collection-splitting logic upstream
* Black having a strong (correct IMO) opinion that """ is better than '''
Differential Revision: https://phab.mercurial-scm.org/D9430
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 27 Nov 2020 17:03:29 -0500 |
parents | d2e1dcd4490d |
children | 4b89cf08d8dc |
comparison
equal
deleted
inserted
replaced
45941:346af7687c6f | 45942:89a2afe31e82 |
---|---|
56 | 56 |
57 # -- Utility functions: commonly/repeatedly needed functionality --------------- | 57 # -- Utility functions: commonly/repeatedly needed functionality --------------- |
58 | 58 |
59 | 59 |
60 def composelargefilematcher(match, manifest): | 60 def composelargefilematcher(match, manifest): |
61 '''create a matcher that matches only the largefiles in the original | 61 """create a matcher that matches only the largefiles in the original |
62 matcher''' | 62 matcher""" |
63 m = copy.copy(match) | 63 m = copy.copy(match) |
64 lfile = lambda f: lfutil.standin(f) in manifest | 64 lfile = lambda f: lfutil.standin(f) in manifest |
65 m._files = [lf for lf in m._files if lfile(lf)] | 65 m._files = [lf for lf in m._files if lfile(lf)] |
66 m._fileset = set(m._files) | 66 m._fileset = set(m._files) |
67 m.always = lambda: False | 67 m.always = lambda: False |
584 mresult.addfile(standin, b'g', sargs, b'replaces standin') | 584 mresult.addfile(standin, b'g', sargs, b'replaces standin') |
585 else: # keep local normal file | 585 else: # keep local normal file |
586 mresult.addfile(lfile, b'k', None, b'replaces standin') | 586 mresult.addfile(lfile, b'k', None, b'replaces standin') |
587 if branchmerge: | 587 if branchmerge: |
588 mresult.addfile( | 588 mresult.addfile( |
589 standin, b'k', None, b'replaced by non-standin', | 589 standin, |
590 b'k', | |
591 None, | |
592 b'replaced by non-standin', | |
590 ) | 593 ) |
591 else: | 594 else: |
592 mresult.addfile( | 595 mresult.addfile( |
593 standin, b'r', None, b'replaced by non-standin', | 596 standin, |
597 b'r', | |
598 None, | |
599 b'replaced by non-standin', | |
594 ) | 600 ) |
595 elif lm in (b'g', b'dc') and sm != b'r': | 601 elif lm in (b'g', b'dc') and sm != b'r': |
596 if lm == b'dc': | 602 if lm == b'dc': |
597 f1, f2, fa, move, anc = largs | 603 f1, f2, fa, move, anc = largs |
598 largs = (p2[f2].flags(), False) | 604 largs = (p2[f2].flags(), False) |
608 ) | 614 ) |
609 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile | 615 if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile |
610 if branchmerge: | 616 if branchmerge: |
611 # largefile can be restored from standin safely | 617 # largefile can be restored from standin safely |
612 mresult.addfile( | 618 mresult.addfile( |
613 lfile, b'k', None, b'replaced by standin', | 619 lfile, |
620 b'k', | |
621 None, | |
622 b'replaced by standin', | |
614 ) | 623 ) |
615 mresult.addfile(standin, b'k', None, b'replaces standin') | 624 mresult.addfile(standin, b'k', None, b'replaces standin') |
616 else: | 625 else: |
617 # "lfile" should be marked as "removed" without | 626 # "lfile" should be marked as "removed" without |
618 # removal of itself | 627 # removal of itself |
626 # linear-merge should treat this largefile as 're-added' | 635 # linear-merge should treat this largefile as 're-added' |
627 mresult.addfile(standin, b'a', None, b'keep standin') | 636 mresult.addfile(standin, b'a', None, b'keep standin') |
628 else: # pick remote normal file | 637 else: # pick remote normal file |
629 mresult.addfile(lfile, b'g', largs, b'replaces standin') | 638 mresult.addfile(lfile, b'g', largs, b'replaces standin') |
630 mresult.addfile( | 639 mresult.addfile( |
631 standin, b'r', None, b'replaced by non-standin', | 640 standin, |
641 b'r', | |
642 None, | |
643 b'replaced by non-standin', | |
632 ) | 644 ) |
633 | 645 |
634 return mresult | 646 return mresult |
635 | 647 |
636 | 648 |