comparison mercurial/changegroup.py @ 24120:a450e0a2ba0a

revlog: in addgroup, reject ill-formed deltas based on censored nodes To ensure interoperability when clones disagree about which file nodes are censored, a restriction is made on deltas based on censored nodes. Any such delta must replace the full text of the base in a single patch. If the recipient of a delta considers the base to be censored and the delta is not in the expected form, the recipient must reject it, as it can't know if the source has also censored the base. For background and broader design of the censorship feature, see: http://mercurial.selenic.com/wiki/CensorPlan
author Mike Edgar <adgar@google.com>
date Fri, 06 Feb 2015 00:55:29 +0000
parents f99a6e1865e5
children d8e0c591781c
comparison
equal deleted inserted replaced
24119:a5a06c9c7407 24120:a450e0a2ba0a
657 f = chunkdata["filename"] 657 f = chunkdata["filename"]
658 repo.ui.debug("adding %s revisions\n" % f) 658 repo.ui.debug("adding %s revisions\n" % f)
659 pr() 659 pr()
660 fl = repo.file(f) 660 fl = repo.file(f)
661 o = len(fl) 661 o = len(fl)
662 if not fl.addgroup(source, revmap, trp): 662 try:
663 raise util.Abort(_("received file revlog group is empty")) 663 if not fl.addgroup(source, revmap, trp):
664 raise util.Abort(_("received file revlog group is empty"))
665 except error.CensoredBaseError, e:
666 raise util.Abort(_("received delta base is censored: %s") % e)
664 revisions += len(fl) - o 667 revisions += len(fl) - o
665 files += 1 668 files += 1
666 if f in needfiles: 669 if f in needfiles:
667 needs = needfiles[f] 670 needs = needfiles[f]
668 for new in xrange(o, len(fl)): 671 for new in xrange(o, len(fl)):