comparison 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
comparison
equal deleted inserted replaced
274:5da941efbb52 275:61d45b0ba8fb
55 55
56 if files: 56 if files:
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 = repo.file(f).read(mmap[f]) 60 to = None
61 if f in mmap:
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))
63 for f in a: 65 for f in a:
64 to = None 66 to = None
65 tn = read(f) 67 tn = read(f)
448 450
449 def undo(ui, repo): 451 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
457 there is a linear relationship between the current version and the 459 there is a linear relationship between the current version and the
458 requested version, the result is the requested version. 460 requested version, the result is the requested version.
462 changed between either parent are marked as changed for the next 464 changed between either parent are marked as changed for the next
463 commit and a commit must be performed before any further updates 465 commit and a commit must be performed before any further updates
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"""
471 return repo.verify() 473 return repo.verify()
472 474
522 "hg serve [options]"), 524 "hg serve [options]"),
523 "status": (status, [], 'hg status'), 525 "status": (status, [], 'hg status'),
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, [], 'hg update [node]'), 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
531 norepo = "init branch help debugindex debugindexdot" 538 norepo = "init branch help debugindex debugindexdot"
532 539
597 except TypeError, inst: 604 except TypeError, inst:
598 # was this an argument error? 605 # was this an argument error?
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)