[PATCH] Add script to rewrite manifest to workaround lack of parent deltas
Benoit Boissinot
benoit.boissinot at ens-lyon.org
Tue Aug 25 14:16:23 UTC 2009
On Mon, Aug 24, 2009 at 05:16:18PM -0400, Greg Ward wrote:
> # HG changeset patch
> # User Greg Ward <greg-hg at gerg.ca>
> # Date 1233047576 0
> # Node ID 9235025c8eb4219a045b8c9d3e95ce5079b2488d
> # Parent 20ed9909dbd9251f76cacb463c480488eebf736b
> Add script to rewrite manifest to workaround lack of parent deltas.
I tested it in the kernel repo, and there are some nodes with duplicate
parents (p1 = p2), so it needs the fix below.
> +
> +def toposort(rl):
> + write = sys.stdout.write
> +
> + children = {}
> + root = []
> + # build children and roots
> + write('reading %d revs ' % len(rl))
> + try:
> + for i in rl:
> + children[i] = []
use set()
> + parents = [p for p in rl.parentrevs(i) if p != node.nullrev]
> + for p in parents:
> + assert p in children
> + children[p].append(i)
use .add(i)
> +
> + if len(parents) == 0:
> + root.append(i)
> +
> + if i % 1000 == 0:
> + write('.')
> + finally:
> + write('\n')
> +
--
:wq
More information about the Mercurial-devel
mailing list