884 if not force and pl[1] != nullid: |
884 if not force and pl[1] != nullid: |
885 self.ui.warn("aborting: outstanding uncommitted merges\n") |
885 self.ui.warn("aborting: outstanding uncommitted merges\n") |
886 return |
886 return |
887 |
887 |
888 p1, p2 = pl[0], node |
888 p1, p2 = pl[0], node |
|
889 pa = self.changelog.ancestor(p1, p2) |
889 m1n = self.changelog.read(p1)[0] |
890 m1n = self.changelog.read(p1)[0] |
890 m2n = self.changelog.read(p2)[0] |
891 m2n = self.changelog.read(p2)[0] |
891 man = self.manifest.ancestor(m1n, m2n) |
892 man = self.manifest.ancestor(m1n, m2n) |
892 m1 = self.manifest.read(m1n) |
893 m1 = self.manifest.read(m1n) |
893 mf1 = self.manifest.readflags(m1n) |
894 mf1 = self.manifest.readflags(m1n) |
932 # "if we changed or they changed, change in merge" |
934 # "if we changed or they changed, change in merge" |
933 a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
935 a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
934 mode = ((a^b) | (a^c)) ^ a |
936 mode = ((a^b) | (a^c)) ^ a |
935 merge[f] = (m1.get(f, nullid), m2[f], mode) |
937 merge[f] = (m1.get(f, nullid), m2[f], mode) |
936 s = 1 |
938 s = 1 |
937 # is this an unmodified file or are we clobbering? |
939 # are we clobbering? |
938 elif mw[f] == m1[f] or force: |
940 # is remote's version newer? |
|
941 # or are we going back in time? |
|
942 elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]): |
939 self.ui.debug(" remote %s is newer, get\n" % f) |
943 self.ui.debug(" remote %s is newer, get\n" % f) |
940 get[f] = m2[f] |
944 get[f] = m2[f] |
941 s = 1 |
945 s = 1 |
|
946 else: |
|
947 mark[f] = 1 |
942 |
948 |
943 if not s and mfw[f] != mf2[f]: |
949 if not s and mfw[f] != mf2[f]: |
944 if force: |
950 if force: |
945 self.ui.debug(" updating permissions for %s\n" % f) |
951 self.ui.debug(" updating permissions for %s\n" % f) |
946 set_exec(self.wjoin(f), mf2[f]) |
952 set_exec(self.wjoin(f), mf2[f]) |
948 a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
954 a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
949 mode = ((a^b) | (a^c)) ^ a |
955 mode = ((a^b) | (a^c)) ^ a |
950 if mode != b: |
956 if mode != b: |
951 self.ui.debug(" updating permissions for %s\n" % f) |
957 self.ui.debug(" updating permissions for %s\n" % f) |
952 set_exec(self.wjoin(f), mode) |
958 set_exec(self.wjoin(f), mode) |
953 |
959 mark[f] = 1 |
954 del m2[f] |
960 del m2[f] |
955 elif f in ma: |
961 elif f in ma: |
956 if not force and n != ma[f]: |
962 if not force and n != ma[f]: |
957 r = self.ui.prompt( |
963 r = self.ui.prompt( |
958 (" local changed %s which remote deleted\n" % f) + |
964 (" local changed %s which remote deleted\n" % f) + |
985 if force: |
991 if force: |
986 for f in merge: |
992 for f in merge: |
987 get[f] = merge[f][1] |
993 get[f] = merge[f][1] |
988 merge = {} |
994 merge = {} |
989 |
995 |
990 if not merge: |
996 if pa == p1 or pa == p2: |
991 # we don't need to do any magic, just jump to the new rev |
997 # we don't need to do any magic, just jump to the new rev |
992 mode = 'n' |
998 mode = 'n' |
993 p1, p2 = p2, nullid |
999 p1, p2 = p2, nullid |
994 else: |
1000 else: |
995 if not allow: |
1001 if not allow: |
996 self.ui.status("the following files conflict:\n") |
1002 self.ui.status("this update spans a branch" + |
997 for f in merge: |
1003 " affecting the following files:\n") |
998 self.ui.status(" %s\n" % f) |
1004 fl = merge.keys() + get.keys() |
999 self.ui.warn("aborting update due to conflicting files!\n") |
1005 fl.sort() |
1000 self.ui.status("(use update -m to allow a merge)\n") |
1006 for f in fl: |
|
1007 cf = "" |
|
1008 if f in merge: cf = " (resolve)" |
|
1009 self.ui.status(" %s%s\n" % (f, cf)) |
|
1010 self.ui.warn("aborting update spanning branches!\n") |
|
1011 self.ui.status("(use update -m to perform a branch merge)\n") |
1001 return 1 |
1012 return 1 |
1002 # we have to remember what files we needed to get/change |
1013 # we have to remember what files we needed to get/change |
1003 # because any file that's different from either one of its |
1014 # because any file that's different from either one of its |
1004 # parents must be in the changeset |
1015 # parents must be in the changeset |
1005 mode = 'm' |
1016 mode = 'm' |
|
1017 self.dirstate.update(mark.keys(), "m") |
1006 |
1018 |
1007 self.dirstate.setparents(p1, p2) |
1019 self.dirstate.setparents(p1, p2) |
1008 |
1020 |
1009 # get the files we don't need to change |
1021 # get the files we don't need to change |
1010 files = get.keys() |
1022 files = get.keys() |