mercurial/bundlerepo.py
changeset 42786 af9c591216ea
parent 42738 161d39e9be4b
child 42831 c070ca6ed86d
equal deleted inserted replaced
42785:e75981b7ce84 42786:af9c591216ea
   103             if revb == rev1:
   103             if revb == rev1:
   104                 return self._chunk(rev2)
   104                 return self._chunk(rev2)
   105         elif rev1 <= self.repotiprev and rev2 <= self.repotiprev:
   105         elif rev1 <= self.repotiprev and rev2 <= self.repotiprev:
   106             return revlog.revlog.revdiff(self, rev1, rev2)
   106             return revlog.revlog.revdiff(self, rev1, rev2)
   107 
   107 
   108         return mdiff.textdiff(self.revision(rev1, raw=True),
   108         return mdiff.textdiff(self.rawdata(rev1),
   109                               self.revision(rev2, raw=True))
   109                               self.rawdata(rev2))
   110 
   110 
   111     def revision(self, nodeorrev, _df=None, raw=False):
   111     def revision(self, nodeorrev, _df=None, raw=False):
   112         """return an uncompressed revision of a given node or revision
   112         """return an uncompressed revision of a given node or revision
   113         number.
   113         number.
   114         """
   114         """
   151 
   151 
   152     def baserevision(self, nodeorrev):
   152     def baserevision(self, nodeorrev):
   153         # Revlog subclasses may override 'revision' method to modify format of
   153         # Revlog subclasses may override 'revision' method to modify format of
   154         # content retrieved from revlog. To use bundlerevlog with such class one
   154         # content retrieved from revlog. To use bundlerevlog with such class one
   155         # needs to override 'baserevision' and make more specific call here.
   155         # needs to override 'baserevision' and make more specific call here.
   156         return revlog.revlog.revision(self, nodeorrev, raw=True)
   156         return revlog.revlog.rawdata(self, nodeorrev)
   157 
   157 
   158     def addrevision(self, *args, **kwargs):
   158     def addrevision(self, *args, **kwargs):
   159         raise NotImplementedError
   159         raise NotImplementedError
   160 
   160 
   161     def addgroup(self, *args, **kwargs):
   161     def addgroup(self, *args, **kwargs):
   182         # This bypasses filtering on changelog.node() and rev() because we need
   182         # This bypasses filtering on changelog.node() and rev() because we need
   183         # revision text of the bundle base even if it is hidden.
   183         # revision text of the bundle base even if it is hidden.
   184         oldfilter = self.filteredrevs
   184         oldfilter = self.filteredrevs
   185         try:
   185         try:
   186             self.filteredrevs = ()
   186             self.filteredrevs = ()
   187             return changelog.changelog.revision(self, nodeorrev, raw=True)
   187             return changelog.changelog.rawdata(self, nodeorrev)
   188         finally:
   188         finally:
   189             self.filteredrevs = oldfilter
   189             self.filteredrevs = oldfilter
   190 
   190 
   191 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
   191 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
   192     def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None,
   192     def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None,
   207             node = self.node(node)
   207             node = self.node(node)
   208 
   208 
   209         if node in self.fulltextcache:
   209         if node in self.fulltextcache:
   210             result = '%s' % self.fulltextcache[node]
   210             result = '%s' % self.fulltextcache[node]
   211         else:
   211         else:
   212             result = manifest.manifestrevlog.revision(self, nodeorrev, raw=True)
   212             result = manifest.manifestrevlog.rawdata(self, nodeorrev)
   213         return result
   213         return result
   214 
   214 
   215     def dirlog(self, d):
   215     def dirlog(self, d):
   216         if d in self._dirlogstarts:
   216         if d in self._dirlogstarts:
   217             self.bundle.seek(self._dirlogstarts[d])
   217             self.bundle.seek(self._dirlogstarts[d])
   225         filelog.filelog.__init__(self, opener, path)
   225         filelog.filelog.__init__(self, opener, path)
   226         self._revlog = bundlerevlog(opener, self.indexfile,
   226         self._revlog = bundlerevlog(opener, self.indexfile,
   227                                     cgunpacker, linkmapper)
   227                                     cgunpacker, linkmapper)
   228 
   228 
   229     def baserevision(self, nodeorrev):
   229     def baserevision(self, nodeorrev):
   230         return filelog.filelog.revision(self, nodeorrev, raw=True)
   230         return filelog.filelog.rawdata(self, nodeorrev)
   231 
   231 
   232 class bundlepeer(localrepo.localpeer):
   232 class bundlepeer(localrepo.localpeer):
   233     def canpush(self):
   233     def canpush(self):
   234         return False
   234         return False
   235 
   235