Mercurial > hg > hgforest
changeset 20:cfe10e98565f
Add --root option to fseed
This clones the root of the forest as well as the children, into the
directory given as an argument to --root.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Tue, 31 Oct 2006 10:12:15 -0800 |
parents | d170ec7fbd39 |
children | 480744732cac |
files | forest.py |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/forest.py Tue Oct 31 14:56:42 2006 +0100 +++ b/forest.py Tue Oct 31 10:12:15 2006 -0800 @@ -35,7 +35,7 @@ cmdtable = None -commands.norepo += " fclone" +commands.norepo += " fclone fseed" def cmd_options(ui, cmd, remove=None): @@ -272,12 +272,16 @@ snapshot(ui, toprepo, doit, pathalias) -def seed(ui, repo, snapshot, pathalias, **opts): +def seed(ui, snapshot, pathalias, **opts): """Populate a forest according to a snapshot file.""" cfg = ConfigParser.RawConfigParser() cfg.read(snapshot) - index = 1 + pfx = opts['root'] + if pfx: + index = 0 + else: + index = 1 while True: index += 1 section = 'tree' + str(index) @@ -285,7 +289,7 @@ break root = cfg.get(section, 'root') ui.write("[%s]\n" % root) - dest = util.localpath(root) + dest = os.path.normpath(os.path.join(pfx, util.localpath(root))) psect = section + '.paths' if not cfg.has_option(psect, pathalias): ui.write(_("skipped, no path alias '%s' defined\n\n") % pathalias) @@ -356,7 +360,9 @@ "fseed" : (seed, [('', 'tip', None, - _("use tip instead of revisions stored in the snapshot file"))] + + _("use tip instead of revisions stored in the snapshot file")), + ('', 'root', '', + _("Create root as well as children under <root>"))] + cmd_options(ui, 'clone', remove=('r',)), _('hg fseed [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')), "fsnap" :