Skip to content
Snippets Groups Projects
Commit 5e74edb7 authored by Siddharth Agarwal's avatar Siddharth Agarwal
Browse files

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.
parent 4e0e9e25
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
......@@ -18,10 +18,10 @@
$ fn_git_commit -m 'add delta'
$ cd ..
clone a tag (ideally we'd want to pull it, but that seems broken for now)
# $ hg init hgrepo
# $ echo "[paths]" >> hgrepo/.hg/hgrc
# $ echo "default=$TESTTMP/gitrepo" >> hgrepo/.hg/hgrc
# $ hg -R hgrepo pull -r t_alpha
$ hg clone -r t_alpha gitrepo hgrepo
pull a tag
$ hg init hgrepo
$ echo "[paths]" >> hgrepo/.hg/hgrc
$ echo "default=$TESTTMP/gitrepo" >> hgrepo/.hg/hgrc
$ hg -R hgrepo pull -r t_alpha
pulling from $TESTTMP/gitrepo
importing git objects into hg
......@@ -27,5 +27,6 @@
importing git objects into hg
updating to branch default
(run 'hg update' to get a working copy)
$ hg -R hgrepo update t_alpha
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R hgrepo log --graph
@ changeset: 0:3442585be8a6
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment