diff mercurial/commands.py @ 5224:20817af258d8

pull -u: if "url#rev" was given, update to rev
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 27 Aug 2007 01:44:35 -0300
parents cbe6e263357b
children bfd73b567b3d 5517aa5aafb0
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Aug 27 01:44:35 2007 -0300
+++ b/mercurial/commands.py	Mon Aug 27 01:44:35 2007 -0300
@@ -2021,12 +2021,12 @@
         for name, path in ui.configitems("paths"):
             ui.write("%s = %s\n" % (name, path))
 
-def postincoming(ui, repo, modheads, optupdate):
+def postincoming(ui, repo, modheads, optupdate, checkout):
     if modheads == 0:
         return
     if optupdate:
-        if modheads <= 1:
-            return hg.update(repo, None)
+        if modheads <= 1 or checkout:
+            return hg.update(repo, checkout)
         else:
             ui.status(_("not updating, since new heads added\n"))
     if modheads > 1:
@@ -2089,7 +2089,7 @@
             raise util.Abort(error)
 
     modheads = repo.pull(other, heads=revs, force=opts['force'])
-    return postincoming(ui, repo, modheads, opts['update'])
+    return postincoming(ui, repo, modheads, opts['update'], checkout)
 
 def push(ui, repo, dest=None, **opts):
     """push changes to the specified destination
@@ -2661,7 +2661,7 @@
         gen = changegroup.readbundle(f, fname)
         modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
 
-    return postincoming(ui, repo, modheads, opts['update'])
+    return postincoming(ui, repo, modheads, opts['update'], None)
 
 def update(ui, repo, node=None, rev=None, clean=False, date=None):
     """update working directory