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