Better fix for issue 622 than we had in c4dd58af0fc8.
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 18 Jul 2007 13:56:08 -0700
changeset 4941 e8c0b52c363c
parent 4933 5fb8f5992a3d
child 4942 b8076522e889
Better fix for issue 622 than we had in c4dd58af0fc8.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Jul 18 16:41:45 2007 +0200
+++ b/mercurial/commands.py	Wed Jul 18 13:56:08 2007 -0700
@@ -2013,13 +2013,11 @@
         for name, path in ui.configitems("paths"):
             ui.write("%s = %s\n" % (name, path))
 
-def postincoming(ui, repo, modheads, optupdate, wasempty):
+def postincoming(ui, repo, modheads, optupdate):
     if modheads == 0:
         return
     if optupdate:
-        if wasempty:
-            return hg.update(repo, repo.lookup('default'))
-        elif modheads == 1:
+        if modheads == 1:
             return hg.update(repo, repo.changelog.tip()) # update
         else:
             ui.status(_("not updating, since new heads added\n"))
@@ -2081,9 +2079,8 @@
             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
             raise util.Abort(error)
 
-    wasempty = repo.changelog.count() == 0
     modheads = repo.pull(other, heads=revs, force=opts['force'])
-    return postincoming(ui, repo, modheads, opts['update'], wasempty)
+    return postincoming(ui, repo, modheads, opts['update'])
 
 def push(ui, repo, dest=None, **opts):
     """push changes to the specified destination
@@ -2647,7 +2644,6 @@
     """
     fnames = (fname1,) + fnames
     result = None
-    wasempty = repo.changelog.count() == 0
     for fname in fnames:
         if os.path.exists(fname):
             f = open(fname, "rb")
@@ -2656,7 +2652,7 @@
         gen = changegroup.readbundle(f, fname)
         modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
 
-    return postincoming(ui, repo, modheads, opts['update'], wasempty)
+    return postincoming(ui, repo, modheads, opts['update'])
 
 def update(ui, repo, node=None, rev=None, clean=False, date=None):
     """update working directory