[cig-commits] commit: Add --root option to fseed
Mercurial
hg at geodynamics.org
Mon Nov 24 11:26:52 PST 2008
changeset: 20:cfe10e98565f
parent: 16:d170ec7fbd39
user: Brendan Cully <brendan at kublai.com>
date: Tue Oct 31 10:12:15 2006 -0800
files: forest.py
description:
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.
diff -r d170ec7fbd39 -r cfe10e98565f forest.py
--- 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 @@ from mercurial.repo import RepoError
cmdtable = None
-commands.norepo += " fclone"
+commands.norepo += " fclone fseed"
def cmd_options(ui, cmd, remove=None):
@@ -272,12 +272,16 @@ def push(ui, toprepo, snapfile, pathalia
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 @@ def seed(ui, repo, snapshot, pathalias,
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 @@ def uisetup(ui):
"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" :
More information about the CIG-COMMITS
mailing list