Mercurial > hg-stable
changeset 6353:04d615b2d5e9
Merge main and crew.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sat, 22 Mar 2008 20:15:30 +0100 |
parents | 34e4f4ef4936 (current diff) eed0a6a05096 (diff) |
children | 57a47660b319 |
files | mercurial/commands.py |
diffstat | 5 files changed, 24 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Mar 22 20:03:00 2008 +0100 +++ b/mercurial/commands.py Sat Mar 22 20:15:30 2008 +0100 @@ -2750,15 +2750,15 @@ tip of the current branch if none is specified. See 'hg help dates' for a list of formats valid for -d/--date. - If there are no outstanding changes in the working directory and - there is a linear relationship between the current version and the - requested version, the result is the requested version. - - To merge the working directory with another revision, use the - merge command. - - By default, update will refuse to run if doing so would require - discarding local changes. + If there are no outstanding changes in the working directory, the + result is the requested version. + + If the requested version is a descendant of the working directory + and there are outstanding changes, those changes will be merged + into the result. + + By default, update will refuse to run if there are outstanding + changes and the update spans branches. """ if rev and node: raise util.Abort(_("please specify just one revision"))
--- a/mercurial/merge.py Sat Mar 22 20:03:00 2008 +0100 +++ b/mercurial/merge.py Sat Mar 22 20:15:30 2008 +0100 @@ -364,8 +364,11 @@ raise util.Abort(_("there is nothing to merge, just use " "'hg update' or look at 'hg heads'")) elif not (overwrite or branchmerge): - raise util.Abort(_("update spans branches, use 'hg merge' " - "or 'hg update -C' to lose changes")) + if wc.files() or wc.deleted(): + raise util.Abort(_("update spans branches, use 'hg merge' " + "or 'hg update -C' to lose changes")) + # Allow jumping branches if there are no changes + overwrite = True if branchmerge and not forcemerge: if wc.files() or wc.deleted(): raise util.Abort(_("outstanding uncommitted changes"))
--- a/mercurial/ui.py Sat Mar 22 20:03:00 2008 +0100 +++ b/mercurial/ui.py Sat Mar 22 20:15:30 2008 +0100 @@ -351,6 +351,8 @@ pass if not user: raise util.Abort(_("Please specify a username.")) + if "\n" in user: + raise util.Abort(_("username %s contains a newline\n") % `user`) return user def shortuser(self, user):
--- a/tests/test-merge5 Sat Mar 22 20:03:00 2008 +0100 +++ b/tests/test-merge5 Sat Mar 22 20:15:30 2008 +0100 @@ -12,9 +12,14 @@ hg update 0 rm b hg commit -A -m"comment #2" -d "1000000 0" +mv a c # in theory, we shouldn't need the "-y" below, but it prevents # this test from hanging when "hg update" erroneously prompts the # user for "keep or delete" +echo % should abort +hg update -y 1 +mv c a +echo % should succeed hg update -y 1 exit 0
--- a/tests/test-merge5.out Sat Mar 22 20:03:00 2008 +0100 +++ b/tests/test-merge5.out Sat Mar 22 20:15:30 2008 +0100 @@ -1,4 +1,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved removing b created new head +% should abort abort: update spans branches, use 'hg merge' or 'hg update -C' to lose changes +% should succeed +1 files updated, 0 files merged, 0 files removed, 0 files unresolved