# HG changeset patch # User Benoit Boissinot # Date 1160421775 -7200 # Node ID fa59d6763441823ae73c6c80271baa8fe045019a # Parent 80654c248793d0a834932b82c686c1fe95fd7c5e# Parent 4546a5e31cb8677b4010ca8998d80bab795b49f9 merge with upstream diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -789,16 +789,25 @@ def bundle(ui, repo, fname, dest=None, * if dest: raise util.Abort(_("--base is incompatible with specifiying " "a destination")) + base = [repo.lookup(rev) for rev in base] + # create the right base + # XXX: nodesbetween / changegroup* should be "fixed" instead o = [] + has_set = sets.Set(base) for n in base: - o.extend(repo.changelog.children(repo.lookup(n))) - # add common ancestor + has_set.update(repo.changelog.reachable(n)) if revs: - all = o + revs + visit = list(revs) else: - all = o + repo.changelog.heads() - ancestor = reduce(lambda a, b: repo.changelog.ancestor(a, b), all) - o.append(ancestor) + visit = repo.changelog.heads() + while visit: + n = visit.pop(0) + parents = [p for p in repo.changelog.parents(n) + if p != nullid and p not in has_set] + if len(parents) == 0: + o.insert(0, n) + else: + visit.extend(parents) else: setremoteconfig(ui, opts) dest = ui.expandpath(dest or 'default-push', dest or 'default') @@ -3137,7 +3146,7 @@ def findpossible(ui, cmd): found = a break if found is not None: - if aliases[0].startswith("debug"): + if aliases[0].startswith("debug") or found.startswith("debug"): debugchoice[found] = (aliases, table[e]) else: choice[found] = (aliases, table[e]) diff --git a/tests/test-bundle-r b/tests/test-bundle-r --- a/tests/test-bundle-r +++ b/tests/test-bundle-r @@ -72,7 +72,8 @@ hg -R test bundle --base 2 -r tip test-b hg -R test bundle --base 2 -r 7 test-bundle-branch2.hg hg -R test bundle --base 2 test-bundle-all.hg hg -R test bundle --base 3 -r tip test-bundle-should-fail.hg -cd test-2 +hg clone test-2 test-9 +cd test-9 echo % 2 hg tip -q hg unbundle ../test-bundle-should-fail.hg @@ -81,13 +82,28 @@ hg tip -q hg unbundle ../test-bundle-all.hg echo % 8 hg tip -q +hg verify hg rollback echo % 2 hg tip -q hg unbundle ../test-bundle-branch1.hg echo % 4 hg tip -q +hg verify +hg rollback hg unbundle ../test-bundle-branch2.hg -echo % 8 +echo % 6 hg tip -q hg verify + +cd ../test +hg merge 7 +hg ci -m merge -d "1000000 0" +cd .. +hg -R test bundle --base 2 test-bundle-head.hg +hg clone test-2 test-10 +cd test-10 +hg unbundle ../test-bundle-head.hg +echo % 9 +hg tip -q +hg verify 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 @@ -148,6 +148,7 @@ rolling back last transaction % should fail abort: --base is incompatible with specifiying a destination abort: repository default-push not found! +1 files updated, 0 files merged, 0 files removed, 0 files unresolved % 2 2:d62976ca1e50 adding changesets @@ -163,6 +164,11 @@ added 6 changesets with 4 changes to 4 f (run 'hg heads' to see heads, 'hg merge' to merge) % 8 8:836ac62537ab +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +4 files, 9 changesets, 7 total revisions rolling back last transaction % 2 2:d62976ca1e50 @@ -173,15 +179,36 @@ added 2 changesets with 2 changes to 2 f (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 +rolling back last transaction adding changesets adding manifests adding file changes -added 4 changesets with 2 changes to 3 files (+1 heads) +added 4 changesets with 3 changes to 3 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) -% 8 -8:80fe151401c2 +% 6 +6:80fe151401c2 checking changesets checking manifests crosschecking files in changesets and manifests checking files -4 files, 9 changesets, 7 total revisions +3 files, 7 changesets, 6 total revisions +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +adding changesets +adding manifests +adding file changes +added 7 changesets with 4 changes to 4 files +(run 'hg update' to get a working copy) +% 9 +9:607fe5912aad +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +4 files, 10 changesets, 7 total revisions diff --git a/tests/test-debugcomplete b/tests/test-debugcomplete new file mode 100755 --- /dev/null +++ b/tests/test-debugcomplete @@ -0,0 +1,39 @@ +#!/bin/sh + +echo '% Show all commands except debug commands' +hg debugcomplete + +echo +echo '% Show all commands that start with "a"' +hg debugcomplete a + +echo +echo '% Do not show debug commands if there are other candidates' +hg debugcomplete d + +echo +echo '% Show debug commands if there are no other candidates' +hg debugcomplete debug + +echo +echo '% Do not show the alias of a debug command if there are other candidates' +echo '% (this should hide rawcommit)' +hg debugcomplete r + +echo +echo '% Show the alias of a debug command if there are no other candidates' +hg debugcomplete rawc + +echo +echo '% Show the global options' +hg debugcomplete --options | sort + +echo +echo '% Show the options for the "serve" command' +hg debugcomplete --options serve | sort + +echo +echo '% Show an error if we use --options with an ambiguous abbreviation' +hg debugcomplete --options s + +exit 0 diff --git a/tests/test-debugcomplete.out b/tests/test-debugcomplete.out new file mode 100644 --- /dev/null +++ b/tests/test-debugcomplete.out @@ -0,0 +1,150 @@ +% Show all commands except debug commands +add +addremove +annotate +archive +backout +bundle +cat +clone +commit +copy +diff +export +grep +heads +help +identify +import +incoming +init +locate +log +manifest +merge +outgoing +parents +paths +pull +push +recover +remove +rename +revert +rollback +root +serve +showconfig +status +tag +tags +tip +unbundle +update +verify +version + +% Show all commands that start with "a" +add +addremove +annotate +archive + +% Do not show debug commands if there are other candidates +diff + +% Show debug commands if there are no other candidates +debugancestor +debugcheckstate +debugcomplete +debugconfig +debugdata +debugforget +debugindex +debugindexdot +debugrawcommit +debugrebuildstate +debugrename +debugsetparents +debugstate +debugundo +debugwalk + +% Do not show the alias of a debug command if there are other candidates +% (this should hide rawcommit) +recover +remove +rename +revert +rollback +root + +% Show the alias of a debug command if there are no other candidates +rawcommit + +% Show the global options +--config +--cwd +--debug +--debugger +--help +--lsprof +--noninteractive +--profile +--quiet +--repository +--time +--traceback +--verbose +--version +-R +-h +-q +-v +-y + +% Show the options for the "serve" command +--accesslog +--address +--config +--cwd +--daemon +--daemon-pipefds +--debug +--debugger +--errorlog +--help +--ipv6 +--lsprof +--name +--noninteractive +--pid-file +--port +--profile +--quiet +--repository +--stdio +--style +--templates +--time +--traceback +--verbose +--version +--webdir-conf +-6 +-A +-E +-R +-a +-d +-h +-n +-p +-q +-t +-v +-y + +% Show an error if we use --options with an ambiguous abbreviation +hg: command 's' is ambiguous: + serve showconfig status