Show More
@@ -85,12 +85,28 b' def prepush(repo, remote, force, revs, n' | |||
|
85 | 85 | _common, inc, remoteheads = commoninc |
|
86 | 86 | |
|
87 | 87 | cl = repo.changelog |
|
88 | outg = cl.findmissing(common, revs) | |
|
88 | alloutg = cl.findmissing(common, revs) | |
|
89 | outg = [] | |
|
90 | secret = [] | |
|
91 | for o in alloutg: | |
|
92 | if repo[o].phase() >= 2: | |
|
93 | secret.append(o) | |
|
94 | else: | |
|
95 | outg.append(o) | |
|
89 | 96 | |
|
90 | 97 | if not outg: |
|
91 | repo.ui.status(_("no changes found\n")) | |
|
98 | if secret: | |
|
99 | repo.ui.status(_("no changes to push but %i secret changesets\n") | |
|
100 | % len(secret)) | |
|
101 | else: | |
|
102 | repo.ui.status(_("no changes found\n")) | |
|
92 | 103 | return None, 1, common |
|
93 | 104 | |
|
105 | if secret: | |
|
106 | # recompute target revs | |
|
107 | revs = [ctx.node() for ctx in repo.set('heads(::(%ld))', | |
|
108 | map(repo.changelog.rev, outg))] | |
|
109 | ||
|
94 | 110 | if not force and remoteheads != [nullid]: |
|
95 | 111 | if remote.capable('branchmap'): |
|
96 | 112 | # Check for each named branch if we're creating new remote heads. |
@@ -9,6 +9,7 b'' | |||
|
9 | 9 | from node import nullid |
|
10 | 10 | from i18n import _ |
|
11 | 11 | import random, collections, util, dagutil |
|
12 | import phases | |
|
12 | 13 | |
|
13 | 14 | def _updatesample(dag, nodes, sample, always, quicksamplesize=0): |
|
14 | 15 | # if nodes is empty we scan the entire graph |
@@ -99,7 +100,7 b' def findcommonheads(ui, local, remote,' | |||
|
99 | 100 | sample = ownheads |
|
100 | 101 | if remote.local(): |
|
101 | 102 | # stopgap until we have a proper localpeer that supports batch() |
|
102 |
srvheadhashes = remote |
|
|
103 | srvheadhashes = phases.visibleheads(remote) | |
|
103 | 104 | yesno = remote.known(dag.externalizeall(sample)) |
|
104 | 105 | elif remote.capable('batch'): |
|
105 | 106 | batch = remote.batch() |
@@ -10,6 +10,7 b' from i18n import _' | |||
|
10 | 10 | from node import bin, hex |
|
11 | 11 | import changegroup as changegroupmod |
|
12 | 12 | import repo, error, encoding, util, store |
|
13 | import phases | |
|
13 | 14 | |
|
14 | 15 | # abstract batching support |
|
15 | 16 | |
@@ -449,7 +450,7 b' def getbundle(repo, proto, others):' | |||
|
449 | 450 | return streamres(proto.groupchunks(cg)) |
|
450 | 451 | |
|
451 | 452 | def heads(repo, proto): |
|
452 |
h = repo |
|
|
453 | h = phases.visibleheads(repo) | |
|
453 | 454 | return encodelist(h) + "\n" |
|
454 | 455 | |
|
455 | 456 | def hello(repo, proto): |
@@ -7,7 +7,9 b'' | |||
|
7 | 7 | $ mkcommit() { |
|
8 | 8 | > echo "$1" > "$1" |
|
9 | 9 | > hg add "$1" |
|
10 |
> |
|
|
10 | > message="$1" | |
|
11 | > shift | |
|
12 | > hg ci -m "$message" $* | |
|
11 | 13 | > } |
|
12 | 14 | |
|
13 | 15 | $ hg init alpha |
@@ -478,6 +480,7 b' Pushing to Publish=False (common changes' | |||
|
478 | 480 | |
|
479 | 481 | Pushing to Publish=True (common changeset from publish=False) |
|
480 | 482 | |
|
483 | (in mu) | |
|
481 | 484 | $ hg push ../alpha |
|
482 | 485 | pushing to ../alpha |
|
483 | 486 | searching for changes |
@@ -506,3 +509,62 b' Pushing to Publish=True (common changese' | |||
|
506 | 509 | 1 0 a-B - 548a3d25dbf0 |
|
507 | 510 | 0 0 a-A - 054250a37db4 |
|
508 | 511 | |
|
512 | ||
|
513 | Discovery locally secret changeset on a remote repository: | |
|
514 | ||
|
515 | - should make it non-secret | |
|
516 | ||
|
517 | $ cd ../alpha | |
|
518 | $ mkcommit A-secret --config phases.new-commit=2 | |
|
519 | $ hgph | |
|
520 | 11 2 A-secret - 435b5d83910c | |
|
521 | 10 0 a-H - 967b449fbc94 | |
|
522 | 9 1 a-G - 3e27b6f1eee1 | |
|
523 | 8 0 a-F - b740e3e5c05d | |
|
524 | 7 0 a-E - e9f537e46dea | |
|
525 | 6 0 n-B - 145e75495359 | |
|
526 | 5 0 n-A - d6bcb4f74035 | |
|
527 | 4 0 b-A - f54f1bb90ff3 | |
|
528 | 3 0 a-D - b555f63b6063 | |
|
529 | 2 0 a-C - 54acac6f23ab | |
|
530 | 1 0 a-B - 548a3d25dbf0 | |
|
531 | 0 0 a-A - 054250a37db4 | |
|
532 | $ hg bundle --base 'parents(.)' -r . ../secret-bundle.hg | |
|
533 | 1 changesets found | |
|
534 | $ hg -R ../mu unbundle ../secret-bundle.hg | |
|
535 | adding changesets | |
|
536 | adding manifests | |
|
537 | adding file changes | |
|
538 | added 1 changesets with 1 changes to 1 files | |
|
539 | (run 'hg update' to get a working copy) | |
|
540 | $ hgph -R ../mu | |
|
541 | 10 1 A-secret - 435b5d83910c | |
|
542 | 9 0 a-H - 967b449fbc94 | |
|
543 | 8 0 a-F - b740e3e5c05d | |
|
544 | 7 0 a-E - e9f537e46dea | |
|
545 | 6 0 n-B - 145e75495359 | |
|
546 | 5 0 n-A - d6bcb4f74035 | |
|
547 | 4 0 a-D - b555f63b6063 | |
|
548 | 3 0 a-C - 54acac6f23ab | |
|
549 | 2 0 b-A - f54f1bb90ff3 | |
|
550 | 1 0 a-B - 548a3d25dbf0 | |
|
551 | 0 0 a-A - 054250a37db4 | |
|
552 | $ hg pull ../mu | |
|
553 | pulling from ../mu | |
|
554 | searching for changes | |
|
555 | no changes found | |
|
556 | $ hgph | |
|
557 | 11 1 A-secret - 435b5d83910c | |
|
558 | 10 0 a-H - 967b449fbc94 | |
|
559 | 9 1 a-G - 3e27b6f1eee1 | |
|
560 | 8 0 a-F - b740e3e5c05d | |
|
561 | 7 0 a-E - e9f537e46dea | |
|
562 | 6 0 n-B - 145e75495359 | |
|
563 | 5 0 n-A - d6bcb4f74035 | |
|
564 | 4 0 b-A - f54f1bb90ff3 | |
|
565 | 3 0 a-D - b555f63b6063 | |
|
566 | 2 0 a-C - 54acac6f23ab | |
|
567 | 1 0 a-B - 548a3d25dbf0 | |
|
568 | 0 0 a-A - 054250a37db4 | |
|
569 | ||
|
570 |
@@ -88,3 +88,49 b' Even on merge' | |||
|
88 | 88 | 1 0 B |
|
89 | 89 | 0 0 A |
|
90 | 90 | |
|
91 | Test secret changeset are not pushed | |
|
92 | ||
|
93 | $ hg init ../push-dest | |
|
94 | $ hg push ../push-dest -f # force because we push multiple heads | |
|
95 | pushing to ../push-dest | |
|
96 | searching for changes | |
|
97 | adding changesets | |
|
98 | adding manifests | |
|
99 | adding file changes | |
|
100 | added 5 changesets with 5 changes to 5 files (+1 heads) | |
|
101 | $ hglog | |
|
102 | 7 2 merge B' and E | |
|
103 | 6 0 B' | |
|
104 | 5 2 H | |
|
105 | 4 2 E | |
|
106 | 3 0 D | |
|
107 | 2 0 C | |
|
108 | 1 0 B | |
|
109 | 0 0 A | |
|
110 | $ cd ../push-dest | |
|
111 | $ hglog | |
|
112 | 4 0 B' | |
|
113 | 3 0 D | |
|
114 | 2 0 C | |
|
115 | 1 0 B | |
|
116 | 0 0 A | |
|
117 | $ cd .. | |
|
118 | ||
|
119 | Test secret changeset are not pull | |
|
120 | ||
|
121 | $ hg init pull-dest | |
|
122 | $ cd pull-dest | |
|
123 | $ hg pull ../initialrepo | |
|
124 | pulling from ../initialrepo | |
|
125 | requesting all changes | |
|
126 | adding changesets | |
|
127 | adding manifests | |
|
128 | adding file changes | |
|
129 | added 5 changesets with 5 changes to 5 files (+1 heads) | |
|
130 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
|
131 | $ hglog | |
|
132 | 4 0 B' | |
|
133 | 3 0 D | |
|
134 | 2 0 C | |
|
135 | 1 0 B | |
|
136 | 0 0 A |
General Comments 0
You need to be logged in to leave comments.
Login now