Show More
@@ -117,7 +117,7 b' class bundlerevlog(revlog.revlog):' | |||||
117 | return mdiff.textdiff(self.revision(self.node(rev1)), |
|
117 | return mdiff.textdiff(self.revision(self.node(rev1)), | |
118 | self.revision(self.node(rev2))) |
|
118 | self.revision(self.node(rev2))) | |
119 |
|
119 | |||
120 | def revision(self, nodeorrev): |
|
120 | def revision(self, nodeorrev, raw=False): | |
121 | """return an uncompressed revision of a given node or revision |
|
121 | """return an uncompressed revision of a given node or revision | |
122 | number. |
|
122 | number. | |
123 | """ |
|
123 | """ |
@@ -783,7 +783,7 b' class cg1packer(object):' | |||||
783 | prefix = '' |
|
783 | prefix = '' | |
784 | if revlog.iscensored(base) or revlog.iscensored(rev): |
|
784 | if revlog.iscensored(base) or revlog.iscensored(rev): | |
785 | try: |
|
785 | try: | |
786 | delta = revlog.revision(node) |
|
786 | delta = revlog.revision(node, raw=True) | |
787 | except error.CensoredNodeError as e: |
|
787 | except error.CensoredNodeError as e: | |
788 | delta = e.tombstone |
|
788 | delta = e.tombstone | |
789 | if base == nullrev: |
|
789 | if base == nullrev: | |
@@ -792,7 +792,7 b' class cg1packer(object):' | |||||
792 | baselen = revlog.rawsize(base) |
|
792 | baselen = revlog.rawsize(base) | |
793 | prefix = mdiff.replacediffheader(baselen, len(delta)) |
|
793 | prefix = mdiff.replacediffheader(baselen, len(delta)) | |
794 | elif base == nullrev: |
|
794 | elif base == nullrev: | |
795 | delta = revlog.revision(node) |
|
795 | delta = revlog.revision(node, raw=True) | |
796 | prefix = mdiff.trivialdiffheader(len(delta)) |
|
796 | prefix = mdiff.trivialdiffheader(len(delta)) | |
797 | else: |
|
797 | else: | |
798 | delta = revlog.revdiff(base, rev) |
|
798 | delta = revlog.revdiff(base, rev) |
@@ -1110,6 +1110,9 b' class filectx(basefilectx):' | |||||
1110 | return filectx(self._repo, self._path, fileid=fileid, |
|
1110 | return filectx(self._repo, self._path, fileid=fileid, | |
1111 | filelog=self._filelog, changeid=changeid) |
|
1111 | filelog=self._filelog, changeid=changeid) | |
1112 |
|
1112 | |||
|
1113 | def rawdata(self): | |||
|
1114 | return self._filelog.revision(self._filenode, raw=True) | |||
|
1115 | ||||
1113 | def data(self): |
|
1116 | def data(self): | |
1114 | try: |
|
1117 | try: | |
1115 | return self._filelog.read(self._filenode) |
|
1118 | return self._filelog.read(self._filenode) |
@@ -445,7 +445,7 b' def debugdata(ui, repo, file_, rev=None,' | |||||
445 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
445 | raise error.CommandError('debugdata', _('invalid arguments')) | |
446 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
|
446 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) | |
447 | try: |
|
447 | try: | |
448 | ui.write(r.revision(r.lookup(rev))) |
|
448 | ui.write(r.revision(r.lookup(rev), raw=True)) | |
449 | except KeyError: |
|
449 | except KeyError: | |
450 | raise error.Abort(_('invalid revision identifier %s') % rev) |
|
450 | raise error.Abort(_('invalid revision identifier %s') % rev) | |
451 |
|
451 |
@@ -1202,12 +1202,14 b' class revlog(object):' | |||||
1202 | return mdiff.textdiff(self.revision(rev1), |
|
1202 | return mdiff.textdiff(self.revision(rev1), | |
1203 | self.revision(rev2)) |
|
1203 | self.revision(rev2)) | |
1204 |
|
1204 | |||
1205 | def revision(self, nodeorrev, _df=None): |
|
1205 | def revision(self, nodeorrev, _df=None, raw=False): | |
1206 | """return an uncompressed revision of a given node or revision |
|
1206 | """return an uncompressed revision of a given node or revision | |
1207 | number. |
|
1207 | number. | |
1208 |
|
1208 | |||
1209 |
_df |
|
1209 | _df - an existing file handle to read from. (internal-only) | |
1210 | used internally. |
|
1210 | raw - an optional argument specifying if the revision data is to be | |
|
1211 | treated as raw data when applying flag transforms. 'raw' should be set | |||
|
1212 | to True when generating changegroups or in debug commands. | |||
1211 | """ |
|
1213 | """ | |
1212 | if isinstance(nodeorrev, int): |
|
1214 | if isinstance(nodeorrev, int): | |
1213 | rev = nodeorrev |
|
1215 | rev = nodeorrev | |
@@ -1412,13 +1414,16 b' class revlog(object):' | |||||
1412 | return True |
|
1414 | return True | |
1413 |
|
1415 | |||
1414 | def _addrevision(self, node, text, transaction, link, p1, p2, flags, |
|
1416 | def _addrevision(self, node, text, transaction, link, p1, p2, flags, | |
1415 | cachedelta, ifh, dfh, alwayscache=False): |
|
1417 | cachedelta, ifh, dfh, alwayscache=False, raw=False): | |
1416 | """internal function to add revisions to the log |
|
1418 | """internal function to add revisions to the log | |
1417 |
|
1419 | |||
1418 | see addrevision for argument descriptions. |
|
1420 | see addrevision for argument descriptions. | |
1419 | invariants: |
|
1421 | invariants: | |
1420 | - text is optional (can be None); if not set, cachedelta must be set. |
|
1422 | - text is optional (can be None); if not set, cachedelta must be set. | |
1421 | if both are set, they must correspond to each other. |
|
1423 | if both are set, they must correspond to each other. | |
|
1424 | - raw is optional; if set to True, it indicates the revision data is to | |||
|
1425 | be treated by _processflags() as raw. It is usually set by changegroup | |||
|
1426 | generation and debug commands. | |||
1422 | """ |
|
1427 | """ | |
1423 | btext = [text] |
|
1428 | btext = [text] | |
1424 | def buildtext(): |
|
1429 | def buildtext(): | |
@@ -1438,8 +1443,9 b' class revlog(object):' | |||||
1438 | fh = ifh |
|
1443 | fh = ifh | |
1439 | else: |
|
1444 | else: | |
1440 | fh = dfh |
|
1445 | fh = dfh | |
1441 | basetext = self.revision(self.node(baserev), _df=fh) |
|
1446 | basetext = self.revision(self.node(baserev), _df=fh, raw=raw) | |
1442 | btext[0] = mdiff.patch(basetext, delta) |
|
1447 | btext[0] = mdiff.patch(basetext, delta) | |
|
1448 | ||||
1443 | try: |
|
1449 | try: | |
1444 | self.checkhash(btext[0], node, p1=p1, p2=p2) |
|
1450 | self.checkhash(btext[0], node, p1=p1, p2=p2) | |
1445 | if flags & REVIDX_ISCENSORED: |
|
1451 | if flags & REVIDX_ISCENSORED: | |
@@ -1668,10 +1674,14 b' class revlog(object):' | |||||
1668 | # the added revision, which will require a call to |
|
1674 | # the added revision, which will require a call to | |
1669 | # revision(). revision() will fast path if there is a cache |
|
1675 | # revision(). revision() will fast path if there is a cache | |
1670 | # hit. So, we tell _addrevision() to always cache in this case. |
|
1676 | # hit. So, we tell _addrevision() to always cache in this case. | |
|
1677 | # We're only using addgroup() in the context of changegroup | |||
|
1678 | # generation so the revision data can always be handled as raw | |||
|
1679 | # by the flagprocessor. | |||
1671 | chain = self._addrevision(node, None, transaction, link, |
|
1680 | chain = self._addrevision(node, None, transaction, link, | |
1672 | p1, p2, flags, (baserev, delta), |
|
1681 | p1, p2, flags, (baserev, delta), | |
1673 | ifh, dfh, |
|
1682 | ifh, dfh, | |
1674 |
alwayscache=bool(addrevisioncb) |
|
1683 | alwayscache=bool(addrevisioncb), | |
|
1684 | raw=True) | |||
1675 |
|
1685 | |||
1676 | if addrevisioncb: |
|
1686 | if addrevisioncb: | |
1677 | addrevisioncb(self, chain) |
|
1687 | addrevisioncb(self, chain) |
@@ -93,7 +93,7 b' class unionrevlog(revlog.revlog):' | |||||
93 | return mdiff.textdiff(self.revision(self.node(rev1)), |
|
93 | return mdiff.textdiff(self.revision(self.node(rev1)), | |
94 | self.revision(self.node(rev2))) |
|
94 | self.revision(self.node(rev2))) | |
95 |
|
95 | |||
96 | def revision(self, nodeorrev): |
|
96 | def revision(self, nodeorrev, raw=False): | |
97 | """return an uncompressed revision of a given node or revision |
|
97 | """return an uncompressed revision of a given node or revision | |
98 | number. |
|
98 | number. | |
99 | """ |
|
99 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now