Mercurial > hg > hgforest
changeset 18:99ec27946a55
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 | e298417139cb |
children | 69b70c66ead8 |
files | forest.py |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/forest.py Tue Oct 31 15:13:02 2006 +0100 +++ b/forest.py Tue Oct 31 10:12:15 2006 -0800 @@ -33,7 +33,7 @@ from mercurial.i18n import gettext as _ from mercurial.repo import RepoError -commands.norepo += " fclone" +commands.norepo += " fclone fseed" def cmd_options(cmd, remove=None): @@ -269,12 +269,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) @@ -282,7 +286,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) @@ -351,7 +355,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('clone', remove=('r',)), _('hg fseed [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')), "fsnap" :