[cig-commits] commit: Streamline fsnap/fseed support for keeping children at tip.

Mercurial hg at geodynamics.org
Mon Nov 24 11:26:54 PST 2008


changeset:   24:2d991bfffb86
user:        Mark White <mark at celos.net>
date:        Fri Nov 03 13:21:48 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.


diff -r 4a6203d00e27 -r 2d991bfffb86 forest.py
--- 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 @@ 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
@@ -183,7 +183,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]
@@ -307,18 +310,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)
 
 
@@ -359,14 +362,16 @@ def uisetup(ui):
              _('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,



More information about the CIG-COMMITS mailing list