mercurial/commands.py
changeset 275 61d45b0ba8fb
parent 270 5a80ed2158c8
child 276 10e325db7347
--- a/mercurial/commands.py	Tue Jun 07 19:02:31 2005 -0800
+++ b/mercurial/commands.py	Tue Jun 07 20:06:05 2005 -0800
@@ -57,7 +57,9 @@
         c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
 
     for f in c:
-        to = repo.file(f).read(mmap[f])
+        to = None
+        if f in mmap:
+            to = repo.file(f).read(mmap[f])
         tn = read(f)
         sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
     for f in a:
@@ -450,7 +452,7 @@
     """undo the last transaction"""
     repo.undo()
 
-def update(ui, repo, node=None):
+def update(ui, repo, node=None, merge=False, clean=False):
     '''update or merge working directory
 
     If there are no outstanding changes in the working directory and
@@ -464,7 +466,7 @@
     are allowed.
     '''
     node = node and repo.lookup(node) or repo.changelog.tip()
-    repo.update(node)
+    return repo.update(node, allow=merge, force=clean)
 
 def verify(ui, repo):
     """verify the integrity of the repository"""
@@ -524,7 +526,12 @@
     "tags": (tags, [], 'hg tags'),
     "tip": (tip, [], 'hg tip'),
     "undo": (undo, [], 'hg undo'),
-    "update|up|checkout|co|resolve": (update, [], 'hg update [node]'),
+    "update|up|checkout|co|resolve": (update,
+                                      [('m', 'merge', None,
+                                        'allow merging of conflicts'),
+                                       ('C', 'clean', None,
+                                        'overwrite locally modified files')],
+                                       'hg update [options] [node]'),
     "verify": (verify, [], 'hg verify'),
     }
 
@@ -599,6 +606,7 @@
         tb = traceback.extract_tb(sys.exc_info()[2])
         if len(tb) > 2: # no
             raise
+        raise
         u.warn("%s: invalid arguments\n" % i[0].__name__)
         u.warn("syntax: %s\n" % i[2])
         sys.exit(-1)