Mercurial > hg-stable
changeset 16092:914bc95e227b
update: use normal update path with --check (issue2450)
This avoids clobbering unknown files on update by not using overwrite mode.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 09 Feb 2012 13:16:20 -0600 |
parents | e1d8218d733b |
children | 7e30f5f2285f |
files | mercurial/commands.py mercurial/merge.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Feb 06 15:36:44 2012 -0600 +++ b/mercurial/commands.py Thu Feb 09 13:16:20 2012 -0600 @@ -5711,18 +5711,20 @@ if check and clean: raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) + if date: + if rev is not None: + raise util.Abort(_("you can't specify a revision and a date")) + rev = cmdutil.finddate(ui, repo, date) + if check: # we could use dirty() but we can ignore merge and branch trivia c = repo[None] if c.modified() or c.added() or c.removed(): raise util.Abort(_("uncommitted local changes")) - - if date: - if rev is not None: - raise util.Abort(_("you can't specify a revision and a date")) - rev = cmdutil.finddate(ui, repo, date) - - if clean or check: + if not rev: + rev = repo[repo[None].branch()].rev() + + if clean: ret = hg.clean(repo, rev) else: ret = hg.update(repo, rev)