hg init: add -u flag to update
authormpm@selenic.com
Fri, 17 Jun 2005 09:03:22 -0800
changeset 393 e3f564643888
parent 392 ee4c80d294e5
child 394 e6db25785b00
hg init: add -u flag to update -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg init: add -u flag to update From: Andrew Thompson <andrewkt@aktzero.com> I was trying to get init to run update by passing an option. The basic part works, but if you use the -u option, you have to specify the changeset number, tag, or tip. Anyone see a way to make this work easier? (minor tweaks by mpm) manifest hash: 9e39e822693e1f175cd5e02a8d4a984d82afbd92 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCswJaywK+sNU5EO8RAuILAJ42ZVtnHnlbq/xz6SxhaWLtI4KZ/QCgqS6F 6EDjkfy1F8dmBTf8Ob3ac/s= =f3WC -----END PGP SIGNATURE-----
mercurial/commands.py
--- a/mercurial/commands.py	Fri Jun 17 08:50:55 2005 -0800
+++ b/mercurial/commands.py	Fri Jun 17 09:03:22 2005 -0800
@@ -354,7 +354,7 @@
 
     ui.write("%s\n" % ' '.join(output))
 
-def init(ui, source=None):
+def init(ui, source=None, **opts):
     """create a new repository or copy an existing one"""
 
     if source:
@@ -388,6 +388,9 @@
         f = repo.opener("hgrc", "w")
         f.write("[paths]\n")
         f.write("default = %s\n" % source)
+
+        if opts['update']:
+            update(ui, repo)
     else:
         repo = hg.repository(ui, ".", create=1)
 
@@ -630,7 +633,8 @@
     "history": (history, [], 'hg history'),
     "help": (help, [], 'hg help [command]'),
     "identify|id": (identify, [], 'hg identify'),
-    "init": (init, [], 'hg init [url]'),
+    "init": (init, [('u', 'update', None, 'update after init')],
+             'hg init [options] [url]'),
     "log": (log, [], 'hg log <file>'),
     "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
     "parents": (parents, [], 'hg parents [node]'),