##// END OF EJS Templates
Added diff option into git and hg changeset objects, representing git formated patch against parent1
marcink -
r2384:5563af83 beta
parent child Browse files
Show More
@@ -194,6 +194,11 b' class GitChangeset(BaseChangeset):'
194
194
195 return _prev(self, branch)
195 return _prev(self, branch)
196
196
197 def diff(self, ignore_whitespace=True, context=3):
198 return ''.join(self.repository.get_diff(self, self.parents[0],
199 ignore_whitespace=ignore_whitespace,
200 context=context))
201
197 def get_file_mode(self, path):
202 def get_file_mode(self, path):
198 """
203 """
199 Returns stat mode of the file at the given ``path``.
204 Returns stat mode of the file at the given ``path``.
@@ -437,6 +437,12 b' class GitRepository(BaseRepository):'
437 if ignore_whitespace:
437 if ignore_whitespace:
438 flags.append('-w')
438 flags.append('-w')
439
439
440 if hasattr(rev1, 'raw_id'):
441 rev1 = getattr(rev1, 'raw_id')
442
443 if hasattr(rev2, 'raw_id'):
444 rev2 = getattr(rev2, 'raw_id')
445
440 if rev1 == self.EMPTY_CHANGESET:
446 if rev1 == self.EMPTY_CHANGESET:
441 rev2 = self.get_changeset(rev2).raw_id
447 rev2 = self.get_changeset(rev2).raw_id
442 cmd = ' '.join(['show'] + flags + [rev2])
448 cmd = ' '.join(['show'] + flags + [rev2])
@@ -136,6 +136,11 b' class MercurialChangeset(BaseChangeset):'
136
136
137 return _prev(self, branch)
137 return _prev(self, branch)
138
138
139 def diff(self, ignore_whitespace=True, context=3):
140 return ''.join(self._ctx.diff(git=True,
141 ignore_whitespace=ignore_whitespace,
142 context=context))
143
139 def _fix_path(self, path):
144 def _fix_path(self, path):
140 """
145 """
141 Paths are stored without trailing slash so we need to get rid off it if
146 Paths are stored without trailing slash so we need to get rid off it if
General Comments 0
You need to be logged in to leave comments. Login now