History

In some situations where a reference is being used but does not exist in _map_git or _map_hg, silently skip the reference rather than throwing an error. This allows hg outgoing to work on repositories which do not contain any revisions at all.

mcc committed 15 years ago

Commit fa577681 parent 37e12a21 file · +8 −3Browse files

Unified · Split

hggit/git_handler.py+8−3
@@ -200,8 +200,11 @@ class GitHandler(object): · 199 unmodified lines
200 changed_refs = [ref for ref, sha in new_refs.iteritems()200 changed_refs = [ref for ref, sha in new_refs.iteritems()
201 if sha != old_refs.get(ref)]201 if sha != old_refs.get(ref)]
202 new = [bin(self.map_hg_get(new_refs[ref])) for ref in changed_refs]202 new = [bin(self.map_hg_get(new_refs[ref])) for ref in changed_refs]
203 old = dict( (bin(self.map_hg_get(old_refs[r])), 1)203 old = {}
204 for r in old_refs)204 for r in old_refs:
205 old_ref = self.map_hg_get(old_refs[r])
206 if old_ref:
207 old[bin(old_ref)] = 1
205 208
206 return old, new209 return old, new
207 except (HangupException, GitProtocolError), e:210 except (HangupException, GitProtocolError), e:
@@ -809,7 +812,9 @@ class GitHandler(object): · 601 unmodified lines
809 # Create a local Git branch name for each812 # Create a local Git branch name for each
810 # Mercurial bookmark.813 # Mercurial bookmark.
811 for key in heads:814 for key in heads:
812 self.git.refs['refs/heads/' + key] = self.map_git_get(heads[key])815 git_ref = self.map_git_get(heads[key])
816 if git_ref:
817 self.git.refs['refs/heads/' + key] = self.map_git_get(heads[key])
813 818
814 def export_hg_tags(self):819 def export_hg_tags(self):
815 for tag, sha in self.repo.tags().iteritems():820 for tag, sha in self.repo.tags().iteritems():

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t