Show More
@@ -57,7 +57,9 b' def dodiff(repo, files = None, node1 = N' | |||
|
57 | 57 | c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) |
|
58 | 58 | |
|
59 | 59 | for f in c: |
|
60 | to = repo.file(f).read(mmap[f]) | |
|
60 | to = None | |
|
61 | if f in mmap: | |
|
62 | to = repo.file(f).read(mmap[f]) | |
|
61 | 63 | tn = read(f) |
|
62 | 64 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
63 | 65 | for f in a: |
@@ -450,7 +452,7 b' def undo(ui, repo):' | |||
|
450 | 452 | """undo the last transaction""" |
|
451 | 453 | repo.undo() |
|
452 | 454 | |
|
453 | def update(ui, repo, node=None): | |
|
455 | def update(ui, repo, node=None, merge=False, clean=False): | |
|
454 | 456 | '''update or merge working directory |
|
455 | 457 | |
|
456 | 458 | If there are no outstanding changes in the working directory and |
@@ -464,7 +466,7 b' def update(ui, repo, node=None):' | |||
|
464 | 466 | are allowed. |
|
465 | 467 | ''' |
|
466 | 468 | node = node and repo.lookup(node) or repo.changelog.tip() |
|
467 | repo.update(node) | |
|
469 | return repo.update(node, allow=merge, force=clean) | |
|
468 | 470 | |
|
469 | 471 | def verify(ui, repo): |
|
470 | 472 | """verify the integrity of the repository""" |
@@ -524,7 +526,12 b' table = {' | |||
|
524 | 526 | "tags": (tags, [], 'hg tags'), |
|
525 | 527 | "tip": (tip, [], 'hg tip'), |
|
526 | 528 | "undo": (undo, [], 'hg undo'), |
|
527 |
"update|up|checkout|co|resolve": (update, |
|
|
529 | "update|up|checkout|co|resolve": (update, | |
|
530 | [('m', 'merge', None, | |
|
531 | 'allow merging of conflicts'), | |
|
532 | ('C', 'clean', None, | |
|
533 | 'overwrite locally modified files')], | |
|
534 | 'hg update [options] [node]'), | |
|
528 | 535 | "verify": (verify, [], 'hg verify'), |
|
529 | 536 | } |
|
530 | 537 | |
@@ -599,6 +606,7 b' def dispatch(args):' | |||
|
599 | 606 | tb = traceback.extract_tb(sys.exc_info()[2]) |
|
600 | 607 | if len(tb) > 2: # no |
|
601 | 608 | raise |
|
609 | raise | |
|
602 | 610 | u.warn("%s: invalid arguments\n" % i[0].__name__) |
|
603 | 611 | u.warn("syntax: %s\n" % i[2]) |
|
604 | 612 | sys.exit(-1) |
@@ -835,9 +835,9 b' class localrepository:' | |||
|
835 | 835 | tr.close() |
|
836 | 836 | return |
|
837 | 837 | |
|
838 | def update(self, node): | |
|
838 | def update(self, node, allow=False, force=False): | |
|
839 | 839 | pl = self.dirstate.parents() |
|
840 | if pl[1] != nullid: | |
|
840 | if not force and pl[1] != nullid: | |
|
841 | 841 | self.ui.warn("aborting: outstanding uncommitted merges\n") |
|
842 | 842 | return |
|
843 | 843 | |
@@ -880,7 +880,7 b' class localrepository:' | |||
|
880 | 880 | get[f] = m2[f] |
|
881 | 881 | del m2[f] |
|
882 | 882 | elif f in ma: |
|
883 | if n != ma[f]: | |
|
883 | if not force and n != ma[f]: | |
|
884 | 884 | r = self.ui.prompt( |
|
885 | 885 | (" local changed %s which remote deleted\n" % f) + |
|
886 | 886 | "(k)eep or (d)elete?", "[kd]", "k") |
@@ -898,22 +898,34 b' class localrepository:' | |||
|
898 | 898 | |
|
899 | 899 | for f, n in m2.iteritems(): |
|
900 | 900 | if f[0] == "/": continue |
|
901 | if f in ma and n != ma[f]: | |
|
902 |
|
|
|
903 |
|
|
|
904 |
|
|
|
905 |
|
|
|
901 | if not force and f in ma and n != ma[f]: | |
|
902 | r = self.ui.prompt( | |
|
903 | ("remote changed %s which local deleted\n" % f) + | |
|
904 | "(k)eep or (d)elete?", "[kd]", "k") | |
|
905 | if r == "d": remove.append(f) | |
|
906 | 906 | else: |
|
907 | 907 | self.ui.debug("remote created %s\n" % f) |
|
908 | 908 | get[f] = n |
|
909 | 909 | |
|
910 | 910 | del mw, m1, m2, ma |
|
911 | 911 | |
|
912 | if force: | |
|
913 | for f in merge: | |
|
914 | get[f] = merge[f][1] | |
|
915 | merge = {} | |
|
916 | ||
|
912 | 917 | if not merge: |
|
913 | 918 | # we don't need to do any magic, just jump to the new rev |
|
914 | 919 | mode = 'n' |
|
915 | 920 | p1, p2 = p2, nullid |
|
916 | 921 | else: |
|
922 | if not allow: | |
|
923 | self.ui.status("the following files conflict:\n") | |
|
924 | for f in merge: | |
|
925 | self.ui.status(" %s\n" % f) | |
|
926 | self.ui.warn("aborting update due to conflicting files!\n") | |
|
927 | self.ui.status("(use update -m to allow a merge)\n") | |
|
928 | return 1 | |
|
917 | 929 | # we have to remember what files we needed to get/change |
|
918 | 930 | # because any file that's different from either one of its |
|
919 | 931 | # parents must be in the changeset |
@@ -976,7 +988,7 b' class localrepository:' | |||
|
976 | 988 | cmd = os.environ.get("HGMERGE", "hgmerge") |
|
977 | 989 | r = os.system("%s %s %s %s" % (cmd, a, b, c)) |
|
978 | 990 | if r: |
|
979 | self.ui.warn("merging %s failed!\n" % f) | |
|
991 | self.ui.warn("merging %s failed!\n" % fn) | |
|
980 | 992 | |
|
981 | 993 | os.unlink(b) |
|
982 | 994 | os.unlink(c) |
General Comments 0
You need to be logged in to leave comments.
Login now