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 |
|
|
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 |
|
|
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 |
|
|
|
635 | fco = mctx[f2] | |
|
636 |
|
|
|
637 |
|
|
|
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 |
|
|
|
689 |
|
|
|
690 |
|
|
|
691 |
|
|
|
692 |
|
|
|
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 |
|
|
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
|
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 |
|
|
|
700 |
|
|
|
701 |
|
|
|
702 |
|
|
|
703 |
|
|
|
704 |
|
|
|
705 |
|
|
|
706 |
|
|
|
707 |
|
|
|
708 |
|
|
|
709 |
|
|
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
|
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 |
|
|
|
715 | updated += 1 | |
|
716 | else: | |
|
717 | merged += 1 | |
|
712 | merged += 1 | |
|
718 | 713 | |
|
719 |
|
|
|
720 |
|
|
|
721 |
|
|
|
722 |
|
|
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
|
726 |
|
|
|
727 |
|
|
|
728 |
|
|
|
729 |
|
|
|
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 |
|
|
|
732 |
|
|
|
733 |
|
|
|
734 |
|
|
|
735 |
|
|
|
736 |
|
|
|
737 |
|
|
|
738 |
|
|
|
739 |
|
|
|
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 |
|
|
|
742 |
|
|
|
743 |
|
|
|
744 |
|
|
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
|
748 |
|
|
|
749 |
|
|
|
750 |
|
|
|
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 |
|
|
|
753 |
|
|
|
754 |
|
|
|
755 |
|
|
|
756 |
|
|
|
757 |
|
|
|
758 |
|
|
|
759 |
|
|
|
760 |
|
|
|
761 |
|
|
|
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 |
|
|
|
764 |
|
|
|
765 |
|
|
|
766 |
|
|
|
767 |
|
|
|
768 |
|
|
|
769 |
|
|
|
770 |
|
|
|
771 |
|
|
|
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 |
|
|
|
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 |
|
|
|
863 |
|
|
|
864 |
|
|
|
865 |
|
|
|
866 |
|
|
|
867 |
|
|
|
868 |
|
|
|
869 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
903 | pass | |
|
890 | # exec change | |
|
891 | for f, args, msg in actions['e']: | |
|
892 | repo.dirstate.normallookup(f) | |
|
904 | 893 | |
|
905 |
|
|
|
906 |
|
|
|
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 |
|
|
|
913 |
|
|
|
914 |
|
|
|
915 |
|
|
|
916 |
|
|
|
917 |
|
|
|
918 |
|
|
|
919 |
|
|
|
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. |
|
|
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 |
|
|
|
938 |
|
|
|
939 |
|
|
|
940 |
|
|
|
941 |
|
|
|
942 |
|
|
|
943 |
|
|
|
944 |
|
|
|
945 |
|
|
|
946 |
|
|
|
947 |
|
|
|
948 |
|
|
|
949 |
|
|
|
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 |
|
|
|
952 |
|
|
|
953 |
|
|
|
954 |
|
|
|
955 |
|
|
|
956 |
|
|
|
957 |
|
|
|
958 |
|
|
|
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