[cig-commits] commit: Add --root option to fseed
Mercurial
hg at geodynamics.org
Mon Nov 24 11:26:51 PST 2008
changeset: 18:99ec27946a55
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 e298417139cb -r 99ec27946a55 forest.py
--- 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.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 @@ 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)
@@ -282,7 +286,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)
@@ -351,7 +355,9 @@ cmdtable = {
"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" :
More information about the CIG-COMMITS
mailing list