Mercurial > hg > hgforest
changeset 24:2d991bfffb86
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.
author | Mark White <mark@celos.net> |
---|---|
date | Fri, 03 Nov 2006 13:21:48 +0000 |
parents | 4a6203d00e27 |
children | 6db2e2e67ae5 |
files | forest.py |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/forest.py Tue Oct 31 10:14:48 2006 -0800 +++ b/forest.py Fri Nov 03 13:21:48 2006 +0000 @@ -168,7 +168,7 @@ 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 @@ -183,7 +183,10 @@ 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] @@ -307,18 +310,18 @@ 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) @@ -359,14 +362,16 @@ _('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(ui, '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,