Mercurial > hg-git
diff hggit/__init__.py @ 706:5e74edb7a62d
safebranchrevs: handle changelog having no commits
The usage of getattr was unsafe. Use hgutil.safehasattr instead.
util.safehasattr has been around since Mercurial 2.0.
This also fixes the formerly disabled test in test-pull.t.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 04 Mar 2014 23:20:50 -0800 |
parents | 2c67099875cd |
children | 96f0463a4e54 |
line wrap: on
line diff
--- a/hggit/__init__.py Tue Mar 04 16:30:12 2014 -0800 +++ b/hggit/__init__.py Tue Mar 04 23:20:50 2014 -0800 @@ -94,7 +94,7 @@ # defend against tracebacks if we specify -r in 'hg pull' def safebranchrevs(orig, lrepo, repo, branches, revs): revs, co = orig(lrepo, repo, branches, revs) - if getattr(lrepo, 'changelog', False) and co not in lrepo.changelog: + if hgutil.safehasattr(lrepo, 'changelog') and co not in lrepo.changelog: co = None return revs, co if getattr(hg, 'addbranchrevs', False):