diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -537,6 +537,7 @@ def bundle(ui, repo, fname, dest=None, * has.update(repo.changelog.reachable(n)) if revs: visit = list(revs) + has.difference_update(revs) else: visit = repo.changelog.heads() seen = {} @@ -544,7 +545,8 @@ def bundle(ui, repo, fname, dest=None, * n = visit.pop(0) parents = [p for p in repo.changelog.parents(n) if p not in has] if len(parents) == 0: - o.insert(0, n) + if n not in has: + o.append(n) else: for p in parents: if p not in seen: diff --git a/tests/test-bundle-r b/tests/test-bundle-r --- a/tests/test-bundle-r +++ b/tests/test-bundle-r @@ -75,6 +75,8 @@ hg -R test bundle --base 3 -r tip test-b # issue76 msg2163 hg -R test bundle --base 3 -r 3 -r 3 test-bundle-cset-3.hg +# issue1910 +hg -R test bundle --base 7 test-bundle-cset-7.hg hg clone test-2 test-9 cd test-9 @@ -99,6 +101,11 @@ hg unbundle ../test-bundle-branch2.hg echo % 6 hg tip -q hg verify +hg rollback +hg unbundle ../test-bundle-cset-7.hg +echo % 4 +hg tip -q +hg verify cd ../test hg merge 7 diff --git a/tests/test-bundle-r.out b/tests/test-bundle-r.out --- a/tests/test-bundle-r.out +++ b/tests/test-bundle-r.out @@ -163,6 +163,7 @@ 4 changesets found 6 changesets found 1 changesets found 1 changesets found +4 changesets found updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved % 2 @@ -213,6 +214,19 @@ checking manifests crosschecking files in changesets and manifests checking files 3 files, 7 changesets, 6 total revisions +rolling back last transaction +adding changesets +adding manifests +adding file changes +added 2 changesets with 2 changes to 2 files +(run 'hg update' to get a working copy) +% 4 +4:836ac62537ab +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +2 files, 5 changesets, 5 total revisions warning: detected divergent renames of afile to: anotherfile adifferentfile