# HG changeset patch # User Matt Mackall # Date 1165430727 21600 # Node ID 302ffecdd7262e5f1a2911504e6afe4dc4c60a45 # Parent 792e61e9a00acf107f454d8d276f10e826bbaf06# Parent 2aef481ac73c320018fc0a14c200a0e5266e3eac Merge with crew diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2215,7 +2215,7 @@ def tag(ui, repo, name, rev_=None, **opt necessary. The file '.hg/localtags' is used for local tags (not shared among repositories). """ - if name in ['tip', '.']: + if name in ['tip', '.', 'null']: raise util.Abort(_("the name '%s' is reserved") % name) if rev_ is not None: ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, " @@ -2275,8 +2275,7 @@ def unbundle(ui, repo, fname, **opts): modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) return postincoming(ui, repo, modheads, opts['update']) -def update(ui, repo, node=None, merge=False, clean=False, force=None, - branch=None): +def update(ui, repo, node=None, clean=False, branch=None): """update or merge working directory Update the working directory to the specified revision. @@ -2721,10 +2720,8 @@ table = { (update, [('b', 'branch', '', _('checkout the head of a specific branch (DEPRECATED)')), - ('m', 'merge', None, _('allow merging of branches (DEPRECATED)')), - ('C', 'clean', None, _('overwrite locally modified files')), - ('f', 'force', None, _('force a merge with outstanding changes'))], - _('hg update [-C] [-f] [REV]')), + ('C', 'clean', None, _('overwrite locally modified files'))], + _('hg update [-C] [REV]')), "verify": (verify, [], _('hg verify')), "version": (version_, [], _('hg version')), } diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -376,6 +376,8 @@ class localrepository(repo.repository): key = self.dirstate.parents()[0] if key == nullid: raise repo.RepoError(_("no revision checked out")) + elif key == 'null': + return nullid n = self.changelog._match(key) if n: return n @@ -1740,8 +1742,13 @@ class localrepository(repo.repository): def addchangegroup(self, source, srctype, url): """add changegroup to repo. - returns number of heads modified or added + 1.""" + return values: + - nothing changed or no source: 0 + - more heads than before: 1+added heads (2..n) + - less heads than before: -1-removed heads (-2..-n) + - number of heads stays the same: 1 + """ def csmap(x): self.ui.debug(_("add changeset %s\n") % short(x)) return cl.count() @@ -1834,7 +1841,11 @@ class localrepository(repo.repository): self.hook("incoming", node=hex(self.changelog.node(i)), source=srctype, url=url) - return newheads - oldheads + 1 + # never return 0 here: + if newheads < oldheads: + return newheads - oldheads - 1 + else: + return newheads - oldheads + 1 def stream_in(self, remote): diff --git a/tests/test-push-warn b/tests/test-push-warn --- a/tests/test-push-warn +++ b/tests/test-push-warn @@ -47,10 +47,11 @@ done HGMERGE=true hg merge 3 hg ci -m c-d -d "1000000 0" -hg push ../c -hg push -r 2 ../c -hg push -r 3 -r 4 ../c -hg push -f -r 3 -r 4 ../c -hg push -r 5 ../c +hg push ../c; echo $? +hg push -r 2 ../c; echo $? +hg push -r 3 ../c; echo $? +hg push -r 3 -r 4 ../c; echo $? +hg push -f -r 3 -r 4 ../c; echo $? +hg push -r 5 ../c; echo $? exit 0 diff --git a/tests/test-push-warn.out b/tests/test-push-warn.out --- a/tests/test-push-warn.out +++ b/tests/test-push-warn.out @@ -33,22 +33,32 @@ pushing to ../c searching for changes abort: push creates new remote branches! (did you forget to merge? use push -f to force) +0 pushing to ../c searching for changes no changes found +0 pushing to ../c searching for changes abort: push creates new remote branches! (did you forget to merge? use push -f to force) +0 +pushing to ../c +searching for changes +abort: push creates new remote branches! +(did you forget to merge? use push -f to force) +0 pushing to ../c searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 1 files (+2 heads) +0 pushing to ../c searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (-1 heads) +0