Merge with crew
authorMatt Mackall <mpm@selenic.com>
Wed, 06 Dec 2006 12:45:27 -0600
changeset 3804 302ffecdd726
parent 3800 792e61e9a00a (current diff)
parent 3803 2aef481ac73c (diff)
child 3805 299d6cce6c0b
child 3816 248a952c0d17
Merge with crew
mercurial/commands.py
--- a/mercurial/commands.py	Tue Dec 05 16:39:54 2006 -0600
+++ b/mercurial/commands.py	Wed Dec 06 12:45:27 2006 -0600
@@ -2215,7 +2215,7 @@
     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 @@
     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 @@
         (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')),
 }
--- a/mercurial/localrepo.py	Tue Dec 05 16:39:54 2006 -0600
+++ b/mercurial/localrepo.py	Wed Dec 06 12:45:27 2006 -0600
@@ -376,6 +376,8 @@
             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 @@
 
     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 @@
                 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):
--- a/tests/test-push-warn	Tue Dec 05 16:39:54 2006 -0600
+++ b/tests/test-push-warn	Wed Dec 06 12:45:27 2006 -0600
@@ -47,10 +47,11 @@
 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
--- a/tests/test-push-warn.out	Tue Dec 05 16:39:54 2006 -0600
+++ b/tests/test-push-warn.out	Wed Dec 06 12:45:27 2006 -0600
@@ -33,22 +33,32 @@
 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