diff mercurial/commands.py @ 275:61d45b0ba8fb

various merge improvements -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 various merge improvements add -C flag: force update and overwrite local changes add -m flag: allow merges with conflicts we no longer do merge by default and we print a warning message when the merge fails fix bug in printing merge failure message fix bug diffing files in 'm' state manifest hash: 75545a6db45d1e371082343d01c9f177df0f9db3 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCpm6tywK+sNU5EO8RAvb+AJ0euC3YkUYA944hds3ooPxbw6NpVwCfc1dj TiNsPIds560S5jgw44eWNto= =GPXN -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 07 Jun 2005 20:06:05 -0800
parents 5a80ed2158c8
children 10e325db7347
line wrap: on
line diff
--- 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)