diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -22,10 +22,10 @@ def parseurl(url, revs=[]): '''parse url#branch, returning url, branch + revs''' if '#' not in url: - return url, (revs or None), revs and revs[-1] or None + return url, (revs or None), revs and revs[0] or None url, branch = url.split('#', 1) - checkout = revs and revs[-1] or branch + checkout = revs and revs[0] or branch return url, (revs or []) + [branch], checkout schemes = { @@ -188,7 +188,7 @@ def clone(ui, source, dest=None, pull=Fa else: src_repo = source origsource = source = src_repo.url() - checkout = rev and rev[-1] or None + checkout = rev and rev[0] or None if dest is None: dest = defaultdest(source) diff --git a/tests/test-pull-r b/tests/test-pull-r --- a/tests/test-pull-r +++ b/tests/test-pull-r @@ -17,6 +17,11 @@ cd copy echo '% pull a missing revision' hg pull -qr missing ../repo +echo '% pull multiple revisions with update' +hg pull -qu -r 0 -r 1 ../repo +hg -q parents +hg rollback + echo '% pull -r 0' hg pull -qr 0 ../repo hg log diff --git a/tests/test-pull-r.out b/tests/test-pull-r.out --- a/tests/test-pull-r.out +++ b/tests/test-pull-r.out @@ -17,6 +17,9 @@ summary: add foo % pull a missing revision abort: unknown revision 'missing'! +% pull multiple revisions with update +0:bbd179dfa0a7 +rolling back last transaction % pull -r 0 changeset: 0:bbd179dfa0a7 tag: tip