Mercurial > hg
view contrib/undumprevlog @ 21047:f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
This patch introduces "summaryremotehooks" to avoid redundant
incoming/outgoing check for "hg summary" in other than
"commands.summary".
Only if "--remote" is not specified for "hg summary", hooks registered
in "summaryremotehooks" are invoked with "None" as "changes" argument
at first, and they should return tuple of two booleans meaning
"whether incomings are needed" and "whether outgoings are needed".
If no hooks return tuple containing "True", "hg summary" does nothing
any more, because incoming/outgoing check is not needed.
Otherwise, hooks are invoked again: at this time, "changes" argument
refers the result of incoming/outgoing check.
This patch also prevents RepoError from being raised if "--remote" is
not specified for "hg summary", because of backward compatibility for
"hg summary --large" without "--remote".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 16 Apr 2014 00:37:24 +0900 |
parents | cba222f01056 |
children | 5bd1f6572db0 |
line wrap: on
line source
#!/usr/bin/env python # Undump a dump from dumprevlog # $ hg init # $ undumprevlog < repo.dump import sys from mercurial import revlog, node, scmutil, util, transaction for fp in (sys.stdin, sys.stdout, sys.stderr): util.setbinary(fp) opener = scmutil.opener('.', False) tr = transaction.transaction(sys.stderr.write, opener, "undump.journal") while True: l = sys.stdin.readline() if not l: break if l.startswith("file:"): f = l[6:-1] r = revlog.revlog(opener, f) print f elif l.startswith("node:"): n = node.bin(l[6:-1]) elif l.startswith("linkrev:"): lr = int(l[9:-1]) elif l.startswith("parents:"): p = l[9:-1].split() p1 = node.bin(p[0]) p2 = node.bin(p[1]) elif l.startswith("length:"): length = int(l[8:-1]) sys.stdin.readline() # start marker d = sys.stdin.read(length) sys.stdin.readline() # end marker r.addrevision(d, tr, lr, p1, p2) tr.close()