diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2013-05-24 21:30:01 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-28 08:02:24 -0700 |
commit | ab64bc9d21957d2ab30cd4a5e5359fb3f9155704 (patch) | |
tree | b218cb73ea4b7bb2feba1c8bf005edd9187c25f0 /contrib/remote-helpers | |
parent | remote-helpers: improve marks usage (diff) | |
download | tgif-ab64bc9d21957d2ab30cd4a5e5359fb3f9155704.tar.xz |
remote-hg: trivial cleanup
It's better to catch the exception later on.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-x | contrib/remote-helpers/git-remote-hg | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index 1e61f4327a..b08f909076 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -185,10 +185,7 @@ class Marks: return rev in self.marks def get_tip(self, branch): - try: - return str(self.tips[branch]) - except KeyError: - return None + return str(self.tips[branch]) def set_tip(self, branch, tip): self.tips[branch] = tip @@ -433,10 +430,10 @@ def export_ref(repo, name, kind, head): global prefix, marks, mode ename = '%s/%s' % (kind, name) - tip = marks.get_tip(ename) - if tip and tip in repo: + try: + tip = marks.get_tip(ename) tip = repo[tip].rev() - else: + except: tip = 0 revs = xrange(tip, head.rev() + 1) |