changeset 10479:bb508b312359 stable

bundle: exclude csets given in --base, unless they are in --rev (issue1910) Thanks Jesse Glick for the first version of this patch.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 16 Nov 2009 16:10:05 -0500
parents 44b4a2a31623
children 3076b39d7f3e
files mercurial/commands.py tests/test-bundle-r tests/test-bundle-r.out
diffstat 3 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Feb 15 00:14:16 2010 +0100
+++ b/mercurial/commands.py	Mon Nov 16 16:10:05 2009 -0500
@@ -537,6 +537,7 @@
             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 @@
             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:
--- a/tests/test-bundle-r	Mon Feb 15 00:14:16 2010 +0100
+++ b/tests/test-bundle-r	Mon Nov 16 16:10:05 2009 -0500
@@ -75,6 +75,8 @@
 
 # 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 @@
 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
--- a/tests/test-bundle-r.out	Mon Feb 15 00:14:16 2010 +0100
+++ b/tests/test-bundle-r.out	Mon Nov 16 16:10:05 2009 -0500
@@ -163,6 +163,7 @@
 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 @@
 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