# HG changeset patch # User mpm@selenic.com # Date 1119027802 28800 # Node ID e3f564643888002955a3f98c68a895782dc50e7b # Parent ee4c80d294e571c7c9edbacbb329e55956add4c0 hg init: add -u flag to update -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg init: add -u flag to update From: Andrew Thompson 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----- diff -r ee4c80d294e5 -r e3f564643888 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 '), "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'), "parents": (parents, [], 'hg parents [node]'),