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 |
|
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 |
|
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 |
|
|
632 | fco = mctx[f2] | |
635 | fco = mctx[f2] |
|
633 | actx = repo[anc] | |
636 |
|
|
634 | if fa in actx: | |
637 |
|
|
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 |
|
|
683 | # re-add (manifest only, just log it) | |
689 |
|
|
684 | for f, args, msg in actions['a']: | |
690 |
|
|
685 | repo.ui.debug(" %s: %s -> a\n" % (f, msg)) | |
691 |
|
|
686 | z += 1 | |
692 |
|
|
687 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
693 |
|
688 | |||
694 |
|
|
689 | # keep (noop, just log it) | |
695 |
|
|
690 | for f, args, msg in actions['k']: | |
696 |
|
|
691 | repo.ui.debug(" %s: %s -> k\n" % (f, msg)) | |
697 |
|
|
692 | # no progress | |
698 |
|
693 | |||
699 |
|
|
694 | # merge | |
700 |
|
|
695 | for f, args, msg in actions['m']: | |
701 |
|
|
696 | repo.ui.debug(" %s: %s -> m\n" % (f, msg)) | |
702 |
|
|
697 | z += 1 | |
703 |
|
|
698 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
704 |
|
|
699 | f1, f2, fa, move, anc = args | |
705 |
|
|
700 | if f == '.hgsubstate': # subrepo states need updating | |
706 |
|
|
701 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | |
707 |
|
|
702 | overwrite) | |
708 |
|
|
703 | continue | |
709 |
|
|
704 | audit(f) | |
710 |
|
|
705 | r = ms.resolve(f, wctx, labels=labels) | |
711 |
|
|
706 | if r is not None and r > 0: | |
712 |
|
|
707 | unresolved += 1 | |
|
708 | else: | |||
|
709 | if r is None: | |||
|
710 | updated += 1 | |||
713 | else: |
|
711 | else: | |
714 |
|
|
712 | merged += 1 | |
715 | updated += 1 |
|
|||
716 | else: |
|
|||
717 | merged += 1 |
|
|||
718 |
|
713 | |||
719 |
|
|
714 | # directory rename, move local | |
720 |
|
|
715 | for f, args, msg in actions['dm']: | |
721 |
|
|
716 | repo.ui.debug(" %s: %s -> dm\n" % (f, msg)) | |
722 |
|
|
717 | z += 1 | |
723 |
|
|
718 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
724 |
|
|
719 | f0, flags = args | |
725 |
|
|
720 | repo.ui.note(_("moving %s to %s\n") % (f0, f)) | |
726 |
|
|
721 | audit(f) | |
727 |
|
|
722 | repo.wwrite(f, wctx.filectx(f0).data(), flags) | |
728 |
|
|
723 | util.unlinkpath(repo.wjoin(f0)) | |
729 |
|
|
724 | updated += 1 | |
730 |
|
725 | |||
731 |
|
|
726 | # local directory rename, get | |
732 |
|
|
727 | for f, args, msg in actions['dg']: | |
733 |
|
|
728 | repo.ui.debug(" %s: %s -> dg\n" % (f, msg)) | |
734 |
|
|
729 | z += 1 | |
735 |
|
|
730 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
736 |
|
|
731 | f0, flags = args | |
737 |
|
|
732 | repo.ui.note(_("getting %s to %s\n") % (f0, f)) | |
738 |
|
|
733 | repo.wwrite(f, mctx.filectx(f0).data(), flags) | |
739 |
|
|
734 | updated += 1 | |
740 |
|
735 | |||
741 |
|
|
736 | # divergent renames | |
742 |
|
|
737 | for f, args, msg in actions['dr']: | |
743 |
|
|
738 | repo.ui.debug(" %s: %s -> dr\n" % (f, msg)) | |
744 |
|
|
739 | z += 1 | |
745 |
|
|
740 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
746 |
|
|
741 | fl, = args | |
747 |
|
|
742 | repo.ui.warn(_("note: possible conflict - %s was renamed " | |
748 |
|
|
743 | "multiple times to:\n") % f) | |
749 |
|
|
744 | for nf in fl: | |
750 |
|
|
745 | repo.ui.warn(" %s\n" % nf) | |
751 |
|
746 | |||
752 |
|
|
747 | # rename and delete | |
753 |
|
|
748 | for f, args, msg in actions['rd']: | |
754 |
|
|
749 | repo.ui.debug(" %s: %s -> rd\n" % (f, msg)) | |
755 |
|
|
750 | z += 1 | |
756 |
|
|
751 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
757 |
|
|
752 | fl, = args | |
758 |
|
|
753 | repo.ui.warn(_("note: possible conflict - %s was deleted " | |
759 |
|
|
754 | "and renamed to:\n") % f) | |
760 |
|
|
755 | for nf in fl: | |
761 |
|
|
756 | repo.ui.warn(" %s\n" % nf) | |
762 |
|
757 | |||
763 |
|
|
758 | # exec | |
764 |
|
|
759 | for f, args, msg in actions['e']: | |
765 |
|
|
760 | repo.ui.debug(" %s: %s -> e\n" % (f, msg)) | |
766 |
|
|
761 | z += 1 | |
767 |
|
|
762 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
768 |
|
|
763 | flags, = args | |
769 |
|
|
764 | audit(f) | |
770 |
|
|
765 | util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) | |
771 |
|
|
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 |
|
|
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 |
|
|
856 | for f, args, msg in actions['dc']: | |
863 |
|
|
857 | flags, = args | |
864 |
|
|
858 | if repo.ui.promptchoice( | |
865 |
|
|
859 | _("remote changed %s which local deleted\n" | |
866 |
|
|
860 | "use (c)hanged version or leave (d)eleted?" | |
867 |
|
|
861 | "$$ &Changed $$ &Deleted") % f, 0) == 0: | |
868 |
|
|
862 | actions['g'].append((f, (flags,), "prompt recreating")) | |
869 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
891 | for f, args, msg in actions['e']: | |
903 | pass |
|
892 | repo.dirstate.normallookup(f) | |
904 |
|
893 | |||
905 |
|
|
894 | # keep | |
906 |
|
|
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 |
|
|
905 | # merge | |
913 |
|
|
906 | for f, args, msg in actions['m']: | |
914 |
|
|
907 | f1, f2, fa, move, anc = args | |
915 |
|
|
908 | if branchmerge: | |
916 |
|
|
909 | # We've done a branch merge, mark this file as merged | |
917 |
|
|
910 | # so that we properly record the merger later | |
918 |
|
|
911 | repo.dirstate.merge(f) | |
919 |
|
|
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. |
|
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 |
|
|
930 | # directory rename, move local | |
938 |
|
|
931 | for f, args, msg in actions['dm']: | |
939 |
|
|
932 | f0, flag = args | |
940 |
|
|
933 | if f0 not in repo.dirstate: | |
941 |
|
|
934 | # untracked file moved | |
942 |
|
|
935 | continue | |
943 |
|
|
936 | if branchmerge: | |
944 |
|
|
937 | repo.dirstate.add(f) | |
945 |
|
|
938 | repo.dirstate.remove(f0) | |
946 |
|
|
939 | repo.dirstate.copy(f0, f) | |
947 |
|
|
940 | else: | |
948 |
|
|
941 | repo.dirstate.normal(f) | |
949 |
|
|
942 | repo.dirstate.drop(f0) | |
950 |
|
943 | |||
951 |
|
|
944 | # directory rename, get | |
952 |
|
|
945 | for f, args, msg in actions['dg']: | |
953 |
|
|
946 | f0, flag = args | |
954 |
|
|
947 | if branchmerge: | |
955 |
|
|
948 | repo.dirstate.add(f) | |
956 |
|
|
949 | repo.dirstate.copy(f0, f) | |
957 |
|
|
950 | else: | |
958 |
|
|
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