mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
revlog: forbid revdiff revisions with non-zero flags
Summary: Calling revdiff with non-zero flags is a sign of a hard-to-debug error. Raise ProgrammingError in this case. The change is straightforward. Apply it to both shallow and full repos. Reviewed By: DurhamG Differential Revision: D6910080 fbshipit-source-id: cbcf1a444de90e104867cc9f1525629b7edda851
This commit is contained in:
parent
d76d41a0b2
commit
a226ef4969
@ -230,6 +230,9 @@ class remotefilelog(object):
|
||||
return linknode
|
||||
|
||||
def revdiff(self, node1, node2):
|
||||
if node1 != nullid and (self.flags(node1) or self.flags(node2)):
|
||||
raise error.ProgrammingError(
|
||||
'cannot revdiff revisions with non-zero flags')
|
||||
return mdiff.textdiff(self.revision(node1, raw=True),
|
||||
self.revision(node2, raw=True))
|
||||
|
||||
|
@ -1482,6 +1482,10 @@ class revlog(object):
|
||||
if rev1 != nullrev and self.deltaparent(rev2) == rev1:
|
||||
return bytes(self._chunk(rev2))
|
||||
|
||||
if rev1 > -1 and (self.flags(rev1) or self.flags(rev2)):
|
||||
raise error.ProgrammingError(
|
||||
'cannot revdiff revisions with non-zero flags')
|
||||
|
||||
return mdiff.textdiff(self.revision(rev1, raw=True),
|
||||
self.revision(rev2, raw=True))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user