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
200200 changed_refs = [ref for ref, sha in new_refs.iteritems()
201201 if sha != old_refs.get(ref)]
202202 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)
204− for r in old_refs)
203+ old = {}
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
205208
206209 return old, new
207210 except (HangupException, GitProtocolError), e:
@@ -809,7 +812,9 @@ class GitHandler(object): · 601 unmodified lines
809812 # Create a local Git branch name for each
810813 # Mercurial bookmark.
811814 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])
813818
814819 def export_hg_tags(self):
815820 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