[cig-commits] commit: Streamline fsnap/fseed support for keeping children at tip.
Mercurial
hg at geodynamics.org
Mon Nov 24 11:26:55 PST 2008
changeset: 27:7af6be6683da
parent: 25:363fd78db7ce
user: Mark White <mark at celos.net>
date: Tue Nov 07 12:37:54 2006 +0000
files: forest.py
description:
Streamline fsnap/fseed support for keeping children at tip.
Added -t/--tip option to fsnap to record tip instead of each actual
current child revision found. Also -t alias for --tip in fseed.
(translation of 2d991bfffb86 for forest-mercurial-0.9.1-branch)
diff -r 363fd78db7ce -r 7af6be6683da forest.py
--- a/forest.py Mon Nov 06 16:52:33 2006 +0100
+++ b/forest.py Tue Nov 07 12:37:54 2006 +0000
@@ -165,7 +165,7 @@ class ForestSnapshot(object):
ui.write("\n")
- def update(self, ui, repo):
+ def update(self, ui, repo, tip):
"""Update a snapshot by scanning a forest.
If the ForestSnapshot instance to update was initialized from
@@ -182,7 +182,10 @@ class ForestSnapshot(object):
raise util.Abort(_("'%s' has mq patches applied") % root)
if root != '.':
repo = repository(ui, root)
- rev = node.hex(repo.dirstate.parents()[0])
+ if tip:
+ rev = 'tip'
+ else:
+ rev = node.hex(repo.dirstate.parents()[0])
paths = dict(repo.ui.configitems('paths'))
if self.rootmap.has_key(root):
tree = self.rootmap[root]
@@ -306,18 +309,18 @@ def seed(ui, snapshot, pathalias='defaul
commands.clone(ui, source, dest, **opts)
if not opts['tip']:
rev = cfg.get(section, 'revision')
- if rev and rev != node.nullid:
+ if rev and rev != 'tip' and rev != node.nullid:
repo = repository(ui, dest)
commands.update(repo.ui, repo, node=rev)
ui.write("\n")
-def snapshot(ui, repo, snapfile=None):
+def snapshot(ui, repo, snapfile=None, **opts):
"""Generate a new or updated forest snapshot and display it."""
snapshot = ForestSnapshot(snapfile)
- snapshot.update(ui, repo)
+ snapshot.update(ui, repo, opts['tip'])
snapshot.write(ui)
@@ -356,14 +359,16 @@ cmdtable = {
_('hg fpush [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
"fseed" :
(seed,
- [('', 'tip', None,
+ [('t', 'tip', None,
_("use tip instead of revisions stored in the snapshot file")),
('', 'root', '',
- _("Create root as well as children under <root>"))] +
+ _("create root as well as children under <root>"))] +
cmd_options('clone', remove=('r',)),
_('hg fseed [OPTIONS] SNAPSHOT-FILE [PATH-ALIAS]')),
"fsnap" :
- (snapshot, [],
+ (snapshot,
+ [('t', 'tip', None,
+ _("record tip instead of actual child revisions"))],
'hg fsnap [SNAPSHOT-FILE]'),
"fstatus" :
(status,
More information about the CIG-COMMITS
mailing list