[cig-commits] commit: `hg fsnap` now uses the Forest framework
Mercurial
hg at geodynamics.org
Mon Nov 24 11:27:11 PST 2008
changeset: 66:e19e732274b7
user: Simon Law <simon at akoha.org>
date: Mon Aug 27 13:45:44 2007 -0400
files: forest.py test-forest test-forest.out
description:
`hg fsnap` now uses the Forest framework
diff -r 0c80cfba6b38 -r e19e732274b7 forest.py
--- a/forest.py Mon Aug 27 13:45:18 2007 -0400
+++ b/forest.py Mon Aug 27 13:45:44 2007 -0400
@@ -1012,12 +1012,29 @@ def seed(ui, snapshot=None, source='defa
ui.status("\n")
-def snapshot(ui, repo, snapfile=None, tip=False, walkhg='', **opts):
- """Generate a new or updated forest snapshot and display it."""
-
- snapshot = ForestSnapshot(snapfile)
- snapshot.update(ui, repo, True, walkhgenabled(ui, walkhg), tip)
- snapshot.write(ui)
+def snap(ui, top, snapshot=None, **opts):
+ """take a snapshot of the forest and show it
+
+ Shows the current state of the forest.
+
+ You can use the output of this command as with the --snapfile
+ option of other forest commands.
+
+ When you provide a snapshot file, only the trees mentioned in that
+ file will be shown.
+ """
+
+ snapfile = snapshot or opts['snapfile']
+ tip = opts['tip']
+ forest = Forest(top=top, snapfile=snapfile,
+ walkhg=walkhgenabled(ui, opts['walkhg']))
+ if snapfile:
+ forest.update(ui)
+ for tree in forest.trees:
+ tree.die_on_mq(top.root)
+ if not tip:
+ tree.revs = tree.working_revs()
+ forest.write(ui, opts['compatible'])
def status(ui, repo, walkhg='', *pats, **opts):
@@ -1103,11 +1120,14 @@ def uisetup(ui):
+ cmd_options(ui, 'clone', remove=('r',)),
_('hg fseed [OPTION]... SNAPSHOT-FILE [PATH-ALIAS]')),
"fsnap" :
- (snapshot,
- [('t', 'tip', False,
+ (snap,
+ [('', 'compatible', False,
+ _("write snapshot file compatible with older forest versions")),
+ snapfileopts,
+ ('t', 'tip', False,
_("record tip instead of actual child revisions")),
walkhgopts],
- _('hg fsnap [OPTIONS] [SNAPSHOT-FILE]')),
+ _('hg fsnap [OPTION]... [SNAPSHOT-FILE]')),
"fstatus" :
(status,
[walkhgopts] + cmd_options(ui, 'status'),
diff -r 0c80cfba6b38 -r e19e732274b7 test-forest
--- a/test-forest Mon Aug 27 13:45:18 2007 -0400
+++ b/test-forest Mon Aug 27 13:45:44 2007 -0400
@@ -71,6 +71,7 @@ hg fseed -R newtop top-snap default
hg fseed -R newtop top-snap default
rm -rf newtop
hg fseed --traceback --root newtop top-snap default >/dev/null
+hg fsnap --cwd newtop --compatible | sed "s@\(/private\)*$HGTMP at HGTMP@g"
hg fsnap --cwd newtop | sed "s@\(/private\)*$HGTMP at HGTMP@g"
rm -rf newtop
diff -r 0c80cfba6b38 -r e19e732274b7 test-forest.out
--- a/test-forest.out Mon Aug 27 13:45:18 2007 -0400
+++ b/test-forest.out Mon Aug 27 13:45:44 2007 -0400
@@ -61,16 +61,14 @@ adding d/d/f2
-revision = fccf42f55033a9715e9e990fcc1749e3d0d19d39
+revision = bc7d06dbb331e93b327d848dc724e61cd2dc2d66
- [tree1.paths]
-
-@@ -24,7 +24,7 @@
+ [tree2]
+ root = d/d/t
+@@ -16,5 +16,5 @@
[tree5]
root = t/t
-revision = 5d60830890a20c050332e222b8307bbb70940a3f
+revision = e7ef7301b2ddca4eca0c4e80fe0cc8c943d05645
-
- [tree5.paths]
# fupdate
changeset: 0:11d08ba64b67
@@ -165,6 +163,31 @@ revision = 5d60830890a20c050332e222b8307
[tree5.paths]
default = HGTMP/test-forest/toplevel/t/t
+[tree1]
+root = .
+revision = fccf42f55033a9715e9e990fcc1749e3d0d19d39
+path.default = HGTMP/test-forest/toplevel
+
+[tree2]
+root = d/d/t
+revision = 11d08ba64b676ed2f87a16089f3a0e5060c7bc36
+path.default = HGTMP/test-forest/toplevel/d/d/t
+
+[tree3]
+root = e/d
+revision = 87ae3032128b3306de675b7b390bc7b594ed74eb
+path.default = HGTMP/test-forest/toplevel/e/d
+
+[tree4]
+root = t
+revision = 37c7c7838b045dddb0718588a6318f002f0bed0a
+path.default = HGTMP/test-forest/toplevel/t
+
+[tree5]
+root = t/t
+revision = 5d60830890a20c050332e222b8307bbb70940a3f
+path.default = HGTMP/test-forest/toplevel/t/t
+
# fpull
[.]
pulling from HGTMP/test-forest/toplevel
More information about the CIG-COMMITS
mailing list