##// END OF EJS Templates
discovery: add extinct changesets to outgoing.excluded...
Patrick Mezard -
r17248:6ffb35b2 stable
parent child Browse files
Show More
@@ -0,0 +1,48 b''
1 Test changesets filtering during exchanges (some tests are still in
2 test-obsolete.t)
3
4 Push does corrupt remote
5 ------------------------
6
7 Create a DAG where a changeset reuses a revision from a file first used in an
8 extinct changeset.
9
10 $ hg init local
11 $ cd local
12 $ echo 'base' > base
13 $ hg commit -Am base
14 adding base
15 $ echo 'A' > A
16 $ hg commit -Am A
17 adding A
18 $ hg up 0
19 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
20 $ hg revert -ar 1
21 adding A
22 $ hg commit -Am "A'"
23 created new head
24 $ hg log -G --template='{desc} {node}'
25 @ A' f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
26 |
27 | o A 9d73aac1b2ed7d53835eaeec212ed41ea47da53a
28 |/
29 o base d20a80d4def38df63a4b330b7fb688f3d4cae1e3
30
31 $ hg debugobsolete 9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
32
33 Push it. The bundle should not refer to the extinct changeset.
34
35 $ hg init ../other
36 $ hg push ../other
37 pushing to ../other
38 searching for changes
39 adding changesets
40 adding manifests
41 adding file changes
42 added 2 changesets with 2 changes to 2 files
43 $ hg -R ../other verify
44 checking changesets
45 checking manifests
46 crosschecking files in changesets and manifests
47 checking files
48 2 files, 2 changesets, 2 total revisions
@@ -1050,7 +1050,7 b' def bundle(ui, repo, fname, dest=None, *'
1050 portable=True)
1050 portable=True)
1051 cg = repo.getlocalbundle('bundle', outgoing)
1051 cg = repo.getlocalbundle('bundle', outgoing)
1052 if not cg:
1052 if not cg:
1053 scmutil.nochangesfound(ui, outgoing and outgoing.excluded)
1053 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1054 return 1
1054 return 1
1055
1055
1056 changegroup.writebundle(cg, fname, bundletype)
1056 changegroup.writebundle(cg, fname, bundletype)
@@ -116,7 +116,7 b' def findcommonoutgoing(repo, other, only'
116 # use visible heads as it should be cached
116 # use visible heads as it should be cached
117 og.missingheads = visibleheads(repo)
117 og.missingheads = visibleheads(repo)
118 # extinct changesets are silently ignored
118 # extinct changesets are silently ignored
119 og.excluded = [ctx.node() for ctx in repo.set('secret()')]
119 og.excluded = [ctx.node() for ctx in repo.set('secret() or extinct()')]
120 else:
120 else:
121 # compute common, missing and exclude secret stuff
121 # compute common, missing and exclude secret stuff
122 sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads)
122 sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads)
@@ -125,12 +125,10 b' def findcommonoutgoing(repo, other, only'
125 og.excluded = excluded = []
125 og.excluded = excluded = []
126 for node in allmissing:
126 for node in allmissing:
127 ctx = repo[node]
127 ctx = repo[node]
128 if not ctx.extinct():
128 if ctx.phase() >= phases.secret or ctx.extinct():
129 # extinct changesets are silently ignored
129 excluded.append(node)
130 if ctx.phase() >= phases.secret:
130 else:
131 excluded.append(node)
131 missing.append(node)
132 else:
133 missing.append(node)
134 if len(missing) == len(allmissing):
132 if len(missing) == len(allmissing):
135 missingheads = onlyheads
133 missingheads = onlyheads
136 else: # update missing heads
134 else: # update missing heads
@@ -525,7 +525,7 b' def _outgoing(ui, repo, dest, opts):'
525 force=opts.get('force'))
525 force=opts.get('force'))
526 o = outgoing.missing
526 o = outgoing.missing
527 if not o:
527 if not o:
528 scmutil.nochangesfound(repo.ui, outgoing.excluded)
528 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded)
529 return None
529 return None
530 return o
530 return o
531
531
@@ -1844,7 +1844,7 b' class localrepository(object):'
1844
1844
1845 if not outgoing.missing:
1845 if not outgoing.missing:
1846 # nothing to push
1846 # nothing to push
1847 scmutil.nochangesfound(self.ui, outgoing.excluded)
1847 scmutil.nochangesfound(self.ui, self, outgoing.excluded)
1848 ret = None
1848 ret = None
1849 else:
1849 else:
1850 # something to push
1850 # something to push
@@ -6,12 +6,21 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from i18n import _
8 from i18n import _
9 import util, error, osutil, revset, similar, encoding
9 import util, error, osutil, revset, similar, encoding, phases
10 import match as matchmod
10 import match as matchmod
11 import os, errno, re, stat, sys, glob
11 import os, errno, re, stat, sys, glob
12
12
13 def nochangesfound(ui, secretlist=None):
13 def nochangesfound(ui, repo, excluded=None):
14 '''report no changes for push/pull'''
14 '''Report no changes for push/pull, excluded is None or a list of
15 nodes excluded from the push/pull.
16 '''
17 secretlist = []
18 if excluded:
19 for n in excluded:
20 ctx = repo[n]
21 if ctx.phase() >= phases.secret and not ctx.extinct():
22 secretlist.append(n)
23
15 if secretlist:
24 if secretlist:
16 ui.status(_("no changes found (ignored %d secret changesets)\n")
25 ui.status(_("no changes found (ignored %d secret changesets)\n")
17 % len(secretlist))
26 % len(secretlist))
General Comments 0
You need to be logged in to leave comments. Login now