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