Show More
@@ -158,15 +158,19 b' class GitRepository(BaseRepository):' | |||
|
158 | 158 | raise RepositoryError(err) |
|
159 | 159 | |
|
160 | 160 | def _get_all_revisions(self): |
|
161 | cmd = 'rev-list --all --date-order' | |
|
161 | cmd = 'rev-list --all --reverse --date-order' | |
|
162 | 162 | try: |
|
163 | 163 | so, se = self.run_git_command(cmd) |
|
164 | 164 | except RepositoryError: |
|
165 | 165 | # Can be raised for empty repositories |
|
166 | 166 | return [] |
|
167 |
re |
|
|
168 | revisions.reverse() | |
|
169 | return revisions | |
|
167 | return so.splitlines() | |
|
168 | ||
|
169 | def _get_all_revisions2(self): | |
|
170 | #alternate implementation using dulwich | |
|
171 | includes = [x[1][0] for x in self._parsed_refs.iteritems() | |
|
172 | if x[1][1] != 'T'] | |
|
173 | return [c.commit.id for c in self._repo.get_walker(include=includes)] | |
|
170 | 174 | |
|
171 | 175 | def _get_revision(self, revision): |
|
172 | 176 | """ |
@@ -264,11 +268,9 b' class GitRepository(BaseRepository):' | |||
|
264 | 268 | def branches(self): |
|
265 | 269 | if not self.revisions: |
|
266 | 270 | return {} |
|
267 | refs = self._repo.refs.as_dict() | |
|
268 | 271 | sortkey = lambda ctx: ctx[0] |
|
269 | _branches = [('/'.join(ref.split('/')[2:]), head) | |
|
270 | for ref, head in refs.items() | |
|
271 | if ref.startswith('refs/heads/') and not ref.endswith('/HEAD')] | |
|
272 | _branches = [(x[0], x[1][0]) | |
|
273 | for x in self._parsed_refs.iteritems() if x[1][1] == 'H'] | |
|
272 | 274 | return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) |
|
273 | 275 | |
|
274 | 276 | @LazyProperty |
@@ -278,9 +280,10 b' class GitRepository(BaseRepository):' | |||
|
278 | 280 | def _get_tags(self): |
|
279 | 281 | if not self.revisions: |
|
280 | 282 | return {} |
|
283 | ||
|
281 | 284 | sortkey = lambda ctx: ctx[0] |
|
282 | _tags = [('/'.join(ref.split('/')[2:]), head) for ref, head in | |
|
283 | self._repo.get_refs().items() if ref.startswith('refs/tags/')] | |
|
285 | _tags = [(x[0], x[1][0]) | |
|
286 | for x in self._parsed_refs.iteritems() if x[1][1] == 'T'] | |
|
284 | 287 | return OrderedDict(sorted(_tags, key=sortkey, reverse=True)) |
|
285 | 288 | |
|
286 | 289 | def tag(self, name, user, revision=None, message=None, date=None, |
General Comments 0
You need to be logged in to leave comments.
Login now