##// END OF EJS Templates
merge: fix stupid indentation left over from previous refactorings
Mads Kiilerich -
r21551:bde505f4 default
parent child Browse files
Show More
@@ -567,15 +567,14 b' def batchremove(repo, actions):'
567 567 i = 0
568 568 for f, args, msg in actions:
569 569 repo.ui.debug(" %s: %s -> r\n" % (f, msg))
570 if True:
571 if verbose:
572 repo.ui.note(_("removing %s\n") % f)
573 audit(f)
574 try:
575 unlink(wjoin(f), ignoremissing=True)
576 except OSError, inst:
577 repo.ui.warn(_("update failed to remove %s: %s!\n") %
578 (f, inst.strerror))
570 if verbose:
571 repo.ui.note(_("removing %s\n") % f)
572 audit(f)
573 try:
574 unlink(wjoin(f), ignoremissing=True)
575 except OSError, inst:
576 repo.ui.warn(_("update failed to remove %s: %s!\n") %
577 (f, inst.strerror))
579 578 if i == 100:
580 579 yield i, f
581 580 i = 0
@@ -596,10 +595,9 b' def batchget(repo, mctx, actions):'
596 595 i = 0
597 596 for f, args, msg in actions:
598 597 repo.ui.debug(" %s: %s -> g\n" % (f, msg))
599 if True:
600 if verbose:
601 repo.ui.note(_("getting %s\n") % f)
602 wwrite(f, fctx(f).data(), args[0])
598 if verbose:
599 repo.ui.note(_("getting %s\n") % f)
600 wwrite(f, fctx(f).data(), args[0])
603 601 if i == 100:
604 602 yield i, f
605 603 i = 0
@@ -626,21 +624,20 b' def applyupdates(repo, actions, wctx, mc'
626 624
627 625 # prescan for merges
628 626 for f, args, msg in actions['m']:
629 if True:
630 f1, f2, fa, move, anc = args
631 if f == '.hgsubstate': # merged internally
632 continue
633 repo.ui.debug(" preserving %s for resolve of %s\n" % (f1, f))
634 fcl = wctx[f1]
635 fco = mctx[f2]
636 actx = repo[anc]
637 if fa in actx:
638 fca = actx[fa]
639 else:
640 fca = repo.filectx(f1, fileid=nullrev)
641 ms.add(fcl, fco, fca, f)
642 if f1 != f and move:
643 moves.append(f1)
627 f1, f2, fa, move, anc = args
628 if f == '.hgsubstate': # merged internally
629 continue
630 repo.ui.debug(" preserving %s for resolve of %s\n" % (f1, f))
631 fcl = wctx[f1]
632 fco = mctx[f2]
633 actx = repo[anc]
634 if fa in actx:
635 fca = actx[fa]
636 else:
637 fca = repo.filectx(f1, fileid=nullrev)
638 ms.add(fcl, fco, fca, f)
639 if f1 != f and move:
640 moves.append(f1)
644 641
645 642 audit = repo.wopener.audit
646 643 _updating = _('updating')
@@ -677,98 +674,96 b' def applyupdates(repo, actions, wctx, mc'
677 674 if [a for a in actions['g'] if a[0] == '.hgsubstate']:
678 675 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
679 676
680 if True:
681
682 # forget (manifest only, just log it) (must come first)
683 for f, args, msg in actions['f']:
684 repo.ui.debug(" %s: %s -> f\n" % (f, msg))
685 z += 1
686 progress(_updating, z, item=f, total=numupdates, unit=_files)
677 # forget (manifest only, just log it) (must come first)
678 for f, args, msg in actions['f']:
679 repo.ui.debug(" %s: %s -> f\n" % (f, msg))
680 z += 1
681 progress(_updating, z, item=f, total=numupdates, unit=_files)
687 682
688 # re-add (manifest only, just log it)
689 for f, args, msg in actions['a']:
690 repo.ui.debug(" %s: %s -> a\n" % (f, msg))
691 z += 1
692 progress(_updating, z, item=f, total=numupdates, unit=_files)
683 # re-add (manifest only, just log it)
684 for f, args, msg in actions['a']:
685 repo.ui.debug(" %s: %s -> a\n" % (f, msg))
686 z += 1
687 progress(_updating, z, item=f, total=numupdates, unit=_files)
693 688
694 # keep (noop, just log it)
695 for f, args, msg in actions['k']:
696 repo.ui.debug(" %s: %s -> k\n" % (f, msg))
697 # no progress
689 # keep (noop, just log it)
690 for f, args, msg in actions['k']:
691 repo.ui.debug(" %s: %s -> k\n" % (f, msg))
692 # no progress
698 693
699 # merge
700 for f, args, msg in actions['m']:
701 repo.ui.debug(" %s: %s -> m\n" % (f, msg))
702 z += 1
703 progress(_updating, z, item=f, total=numupdates, unit=_files)
704 f1, f2, fa, move, anc = args
705 if f == '.hgsubstate': # subrepo states need updating
706 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
707 overwrite)
708 continue
709 audit(f)
710 r = ms.resolve(f, wctx, labels=labels)
711 if r is not None and r > 0:
712 unresolved += 1
694 # merge
695 for f, args, msg in actions['m']:
696 repo.ui.debug(" %s: %s -> m\n" % (f, msg))
697 z += 1
698 progress(_updating, z, item=f, total=numupdates, unit=_files)
699 f1, f2, fa, move, anc = args
700 if f == '.hgsubstate': # subrepo states need updating
701 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
702 overwrite)
703 continue
704 audit(f)
705 r = ms.resolve(f, wctx, labels=labels)
706 if r is not None and r > 0:
707 unresolved += 1
708 else:
709 if r is None:
710 updated += 1
713 711 else:
714 if r is None:
715 updated += 1
716 else:
717 merged += 1
712 merged += 1
718 713
719 # directory rename, move local
720 for f, args, msg in actions['dm']:
721 repo.ui.debug(" %s: %s -> dm\n" % (f, msg))
722 z += 1
723 progress(_updating, z, item=f, total=numupdates, unit=_files)
724 f0, flags = args
725 repo.ui.note(_("moving %s to %s\n") % (f0, f))
726 audit(f)
727 repo.wwrite(f, wctx.filectx(f0).data(), flags)
728 util.unlinkpath(repo.wjoin(f0))
729 updated += 1
714 # directory rename, move local
715 for f, args, msg in actions['dm']:
716 repo.ui.debug(" %s: %s -> dm\n" % (f, msg))
717 z += 1
718 progress(_updating, z, item=f, total=numupdates, unit=_files)
719 f0, flags = args
720 repo.ui.note(_("moving %s to %s\n") % (f0, f))
721 audit(f)
722 repo.wwrite(f, wctx.filectx(f0).data(), flags)
723 util.unlinkpath(repo.wjoin(f0))
724 updated += 1
730 725
731 # local directory rename, get
732 for f, args, msg in actions['dg']:
733 repo.ui.debug(" %s: %s -> dg\n" % (f, msg))
734 z += 1
735 progress(_updating, z, item=f, total=numupdates, unit=_files)
736 f0, flags = args
737 repo.ui.note(_("getting %s to %s\n") % (f0, f))
738 repo.wwrite(f, mctx.filectx(f0).data(), flags)
739 updated += 1
726 # local directory rename, get
727 for f, args, msg in actions['dg']:
728 repo.ui.debug(" %s: %s -> dg\n" % (f, msg))
729 z += 1
730 progress(_updating, z, item=f, total=numupdates, unit=_files)
731 f0, flags = args
732 repo.ui.note(_("getting %s to %s\n") % (f0, f))
733 repo.wwrite(f, mctx.filectx(f0).data(), flags)
734 updated += 1
740 735
741 # divergent renames
742 for f, args, msg in actions['dr']:
743 repo.ui.debug(" %s: %s -> dr\n" % (f, msg))
744 z += 1
745 progress(_updating, z, item=f, total=numupdates, unit=_files)
746 fl, = args
747 repo.ui.warn(_("note: possible conflict - %s was renamed "
748 "multiple times to:\n") % f)
749 for nf in fl:
750 repo.ui.warn(" %s\n" % nf)
736 # divergent renames
737 for f, args, msg in actions['dr']:
738 repo.ui.debug(" %s: %s -> dr\n" % (f, msg))
739 z += 1
740 progress(_updating, z, item=f, total=numupdates, unit=_files)
741 fl, = args
742 repo.ui.warn(_("note: possible conflict - %s was renamed "
743 "multiple times to:\n") % f)
744 for nf in fl:
745 repo.ui.warn(" %s\n" % nf)
751 746
752 # rename and delete
753 for f, args, msg in actions['rd']:
754 repo.ui.debug(" %s: %s -> rd\n" % (f, msg))
755 z += 1
756 progress(_updating, z, item=f, total=numupdates, unit=_files)
757 fl, = args
758 repo.ui.warn(_("note: possible conflict - %s was deleted "
759 "and renamed to:\n") % f)
760 for nf in fl:
761 repo.ui.warn(" %s\n" % nf)
747 # rename and delete
748 for f, args, msg in actions['rd']:
749 repo.ui.debug(" %s: %s -> rd\n" % (f, msg))
750 z += 1
751 progress(_updating, z, item=f, total=numupdates, unit=_files)
752 fl, = args
753 repo.ui.warn(_("note: possible conflict - %s was deleted "
754 "and renamed to:\n") % f)
755 for nf in fl:
756 repo.ui.warn(" %s\n" % nf)
762 757
763 # exec
764 for f, args, msg in actions['e']:
765 repo.ui.debug(" %s: %s -> e\n" % (f, msg))
766 z += 1
767 progress(_updating, z, item=f, total=numupdates, unit=_files)
768 flags, = args
769 audit(f)
770 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
771 updated += 1
758 # exec
759 for f, args, msg in actions['e']:
760 repo.ui.debug(" %s: %s -> e\n" % (f, msg))
761 z += 1
762 progress(_updating, z, item=f, total=numupdates, unit=_files)
763 flags, = args
764 audit(f)
765 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
766 updated += 1
772 767
773 768 ms.commit()
774 769 progress(_updating, None, total=numupdates, unit=_files)
@@ -848,25 +843,24 b' def calculateupdates(repo, wctx, mctx, a'
848 843 repo.ui.note(_('end of auction\n\n'))
849 844
850 845 # Prompt and create actions. TODO: Move this towards resolve phase.
851 if True:
852 for f, args, msg in actions['cd']:
853 if repo.ui.promptchoice(
854 _("local changed %s which remote deleted\n"
855 "use (c)hanged version or (d)elete?"
856 "$$ &Changed $$ &Delete") % f, 0):
857 actions['r'].append((f, None, "prompt delete"))
858 else:
859 actions['a'].append((f, None, "prompt keep"))
860 del actions['cd'][:]
846 for f, args, msg in actions['cd']:
847 if repo.ui.promptchoice(
848 _("local changed %s which remote deleted\n"
849 "use (c)hanged version or (d)elete?"
850 "$$ &Changed $$ &Delete") % f, 0):
851 actions['r'].append((f, None, "prompt delete"))
852 else:
853 actions['a'].append((f, None, "prompt keep"))
854 del actions['cd'][:]
861 855
862 for f, args, msg in actions['dc']:
863 flags, = args
864 if repo.ui.promptchoice(
865 _("remote changed %s which local deleted\n"
866 "use (c)hanged version or leave (d)eleted?"
867 "$$ &Changed $$ &Deleted") % f, 0) == 0:
868 actions['g'].append((f, (flags,), "prompt recreating"))
869 del actions['dc'][:]
856 for f, args, msg in actions['dc']:
857 flags, = args
858 if repo.ui.promptchoice(
859 _("remote changed %s which local deleted\n"
860 "use (c)hanged version or leave (d)eleted?"
861 "$$ &Changed $$ &Deleted") % f, 0) == 0:
862 actions['g'].append((f, (flags,), "prompt recreating"))
863 del actions['dc'][:]
870 864
871 865 if wctx.rev() is None:
872 866 ractions, factions = _forgetremoved(wctx, mctx, branchmerge)
@@ -877,85 +871,84 b' def calculateupdates(repo, wctx, mctx, a'
877 871
878 872 def recordupdates(repo, actions, branchmerge):
879 873 "record merge actions to the dirstate"
880 if True:
881 # remove (must come first)
882 for f, args, msg in actions['r']:
883 if branchmerge:
884 repo.dirstate.remove(f)
885 else:
886 repo.dirstate.drop(f)
887
888 # forget (must come first)
889 for f, args, msg in actions['f']:
874 # remove (must come first)
875 for f, args, msg in actions['r']:
876 if branchmerge:
877 repo.dirstate.remove(f)
878 else:
890 879 repo.dirstate.drop(f)
891 880
892 # re-add
893 for f, args, msg in actions['a']:
894 if not branchmerge:
895 repo.dirstate.add(f)
881 # forget (must come first)
882 for f, args, msg in actions['f']:
883 repo.dirstate.drop(f)
896 884
897 # exec change
898 for f, args, msg in actions['e']:
899 repo.dirstate.normallookup(f)
885 # re-add
886 for f, args, msg in actions['a']:
887 if not branchmerge:
888 repo.dirstate.add(f)
900 889
901 # keep
902 for f, args, msg in actions['k']:
903 pass
890 # exec change
891 for f, args, msg in actions['e']:
892 repo.dirstate.normallookup(f)
904 893
905 # get
906 for f, args, msg in actions['g']:
907 if branchmerge:
908 repo.dirstate.otherparent(f)
909 else:
910 repo.dirstate.normal(f)
894 # keep
895 for f, args, msg in actions['k']:
896 pass
897
898 # get
899 for f, args, msg in actions['g']:
900 if branchmerge:
901 repo.dirstate.otherparent(f)
902 else:
903 repo.dirstate.normal(f)
911 904
912 # merge
913 for f, args, msg in actions['m']:
914 f1, f2, fa, move, anc = args
915 if branchmerge:
916 # We've done a branch merge, mark this file as merged
917 # so that we properly record the merger later
918 repo.dirstate.merge(f)
919 if f1 != f2: # copy/rename
920 if move:
921 repo.dirstate.remove(f1)
922 if f1 != f:
923 repo.dirstate.copy(f1, f)
924 else:
925 repo.dirstate.copy(f2, f)
926 else:
927 # We've update-merged a locally modified file, so
928 # we set the dirstate to emulate a normal checkout
929 # of that file some time in the past. Thus our
930 # merge will appear as a normal local file
931 # modification.
932 if f2 == f: # file not locally copied/moved
933 repo.dirstate.normallookup(f)
905 # merge
906 for f, args, msg in actions['m']:
907 f1, f2, fa, move, anc = args
908 if branchmerge:
909 # We've done a branch merge, mark this file as merged
910 # so that we properly record the merger later
911 repo.dirstate.merge(f)
912 if f1 != f2: # copy/rename
934 913 if move:
935 repo.dirstate.drop(f1)
914 repo.dirstate.remove(f1)
915 if f1 != f:
916 repo.dirstate.copy(f1, f)
917 else:
918 repo.dirstate.copy(f2, f)
919 else:
920 # We've update-merged a locally modified file, so
921 # we set the dirstate to emulate a normal checkout
922 # of that file some time in the past. Thus our
923 # merge will appear as a normal local file
924 # modification.
925 if f2 == f: # file not locally copied/moved
926 repo.dirstate.normallookup(f)
927 if move:
928 repo.dirstate.drop(f1)
936 929
937 # directory rename, move local
938 for f, args, msg in actions['dm']:
939 f0, flag = args
940 if f0 not in repo.dirstate:
941 # untracked file moved
942 continue
943 if branchmerge:
944 repo.dirstate.add(f)
945 repo.dirstate.remove(f0)
946 repo.dirstate.copy(f0, f)
947 else:
948 repo.dirstate.normal(f)
949 repo.dirstate.drop(f0)
930 # directory rename, move local
931 for f, args, msg in actions['dm']:
932 f0, flag = args
933 if f0 not in repo.dirstate:
934 # untracked file moved
935 continue
936 if branchmerge:
937 repo.dirstate.add(f)
938 repo.dirstate.remove(f0)
939 repo.dirstate.copy(f0, f)
940 else:
941 repo.dirstate.normal(f)
942 repo.dirstate.drop(f0)
950 943
951 # directory rename, get
952 for f, args, msg in actions['dg']:
953 f0, flag = args
954 if branchmerge:
955 repo.dirstate.add(f)
956 repo.dirstate.copy(f0, f)
957 else:
958 repo.dirstate.normal(f)
944 # directory rename, get
945 for f, args, msg in actions['dg']:
946 f0, flag = args
947 if branchmerge:
948 repo.dirstate.add(f)
949 repo.dirstate.copy(f0, f)
950 else:
951 repo.dirstate.normal(f)
959 952
960 953 def update(repo, node, branchmerge, force, partial, ancestor=None,
961 954 mergeancestor=False, labels=None):
General Comments 0
You need to be logged in to leave comments. Login now