##// END OF EJS Templates
obsolete: reports the number of local changeset obsoleted when unbundling...
marmoute -
r33249:53b3a196 default
parent child Browse files
Show More
@@ -161,6 +161,7 b' from . import ('
161 phases,
161 phases,
162 pushkey,
162 pushkey,
163 pycompat,
163 pycompat,
164 scmutil,
164 tags,
165 tags,
165 url,
166 url,
166 util,
167 util,
@@ -1810,6 +1811,7 b' def handleobsmarker(op, inpart):'
1810 if new:
1811 if new:
1811 op.repo.ui.status(_('%i new obsolescence markers\n') % new)
1812 op.repo.ui.status(_('%i new obsolescence markers\n') % new)
1812 op.records.add('obsmarkers', {'new': new})
1813 op.records.add('obsmarkers', {'new': new})
1814 scmutil.registersummarycallback(op.repo, tr)
1813 if op.reply is not None:
1815 if op.reply is not None:
1814 rpart = op.reply.newpart('reply:obsmarkers')
1816 rpart = op.reply.newpart('reply:obsmarkers')
1815 rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
1817 rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
@@ -7,6 +7,10 b''
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from . import (
11 phases,
12 )
13
10 class marker(object):
14 class marker(object):
11 """Wrap obsolete marker raw data"""
15 """Wrap obsolete marker raw data"""
12
16
@@ -285,6 +289,28 b' def foreground(repo, nodes):'
285 foreground = set(repo.set('%ln::', known))
289 foreground = set(repo.set('%ln::', known))
286 return set(c.node() for c in foreground)
290 return set(c.node() for c in foreground)
287
291
292 def getobsoleted(repo, tr):
293 """return the set of pre-existing revisions obsoleted by a transaction"""
294 torev = repo.unfiltered().changelog.nodemap.get
295 phase = repo._phasecache.phase
296 succsmarkers = repo.obsstore.successors.get
297 public = phases.public
298 addedmarkers = tr.changes.get('obsmarkers')
299 addedrevs = tr.changes.get('revs')
300 seenrevs = set(addedrevs)
301 obsoleted = set()
302 for mark in addedmarkers:
303 node = mark[0]
304 rev = torev(node)
305 if rev is None or rev in seenrevs:
306 continue
307 seenrevs.add(rev)
308 if phase(repo, rev) == public:
309 continue
310 if set(succsmarkers(node)).issubset(addedmarkers):
311 obsoleted.add(rev)
312 return obsoleted
313
288 def successorssets(repo, initialnode, cache=None):
314 def successorssets(repo, initialnode, cache=None):
289 """Return set of all latest successors of initial nodes
315 """Return set of all latest successors of initial nodes
290
316
@@ -13,6 +13,7 b' import hashlib'
13 import os
13 import os
14 import re
14 import re
15 import socket
15 import socket
16 import weakref
16
17
17 from .i18n import _
18 from .i18n import _
18 from .node import (
19 from .node import (
@@ -22,11 +23,13 b' from .node import ('
22 wdirrev,
23 wdirrev,
23 )
24 )
24
25
26 from .i18n import _
25 from . import (
27 from . import (
26 encoding,
28 encoding,
27 error,
29 error,
28 match as matchmod,
30 match as matchmod,
29 obsolete,
31 obsolete,
32 obsutil,
30 pathutil,
33 pathutil,
31 phases,
34 phases,
32 pycompat,
35 pycompat,
@@ -1059,3 +1062,15 b' class simplekeyvaluefile(object):'
1059 lines.append("%s=%s\n" % (k, v))
1062 lines.append("%s=%s\n" % (k, v))
1060 with self.vfs(self.path, mode='wb', atomictemp=True) as fp:
1063 with self.vfs(self.path, mode='wb', atomictemp=True) as fp:
1061 fp.write(''.join(lines))
1064 fp.write(''.join(lines))
1065
1066 def registersummarycallback(repo, otr):
1067 """register a callback to issue a summary after the transaction is closed
1068 """
1069 reporef = weakref.ref(repo)
1070 def reportsummary(tr):
1071 """the actual callback reporting the summary"""
1072 repo = reporef()
1073 obsoleted = obsutil.getobsoleted(repo, tr)
1074 if obsoleted:
1075 repo.ui.status(_('obsoleted %i changesets\n') % len(obsoleted))
1076 otr.addpostclose('00-txnreport', reportsummary)
@@ -484,6 +484,7 b' Update to a successor works'
484 remote: adding file changes
484 remote: adding file changes
485 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
485 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
486 remote: 2 new obsolescence markers
486 remote: 2 new obsolescence markers
487 remote: obsoleted 1 changesets
487 updating bookmark Y
488 updating bookmark Y
488 $ hg -R ../a book
489 $ hg -R ../a book
489 @ 1:0d2164f0ce0d
490 @ 1:0d2164f0ce0d
@@ -212,6 +212,7 b' test obsmarkers exchange.'
212 remote: adding file changes
212 remote: adding file changes
213 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
213 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
214 remote: 1 new obsolescence markers
214 remote: 1 new obsolescence markers
215 remote: obsoleted 1 changesets
215 ## post push state
216 ## post push state
216 # obstore: main
217 # obstore: main
217 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
218 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -227,6 +228,7 b' test obsmarkers exchange.'
227 adding file changes
228 adding file changes
228 added 1 changesets with 1 changes to 1 files (+1 heads)
229 added 1 changesets with 1 changes to 1 files (+1 heads)
229 1 new obsolescence markers
230 1 new obsolescence markers
231 obsoleted 1 changesets
230 (run 'hg heads' to see heads, 'hg merge' to merge)
232 (run 'hg heads' to see heads, 'hg merge' to merge)
231 ## post pull state
233 ## post pull state
232 # obstore: main
234 # obstore: main
@@ -97,6 +97,7 b' Actual Test (explicit push version)'
97 searching for changes
97 searching for changes
98 no changes found
98 no changes found
99 remote: 1 new obsolescence markers
99 remote: 1 new obsolescence markers
100 remote: obsoleted 1 changesets
100 ## post push state
101 ## post push state
101 # obstore: main
102 # obstore: main
102 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
103 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -107,6 +108,7 b' Actual Test (explicit push version)'
107 pulling from main
108 pulling from main
108 no changes found
109 no changes found
109 1 new obsolescence markers
110 1 new obsolescence markers
111 obsoleted 1 changesets
110 ## post pull state
112 ## post pull state
111 # obstore: main
113 # obstore: main
112 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
114 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -130,6 +132,7 b' Actual Test (bare push version)'
130 searching for changes
132 searching for changes
131 no changes found
133 no changes found
132 remote: 1 new obsolescence markers
134 remote: 1 new obsolescence markers
135 remote: obsoleted 1 changesets
133 ## post push state
136 ## post push state
134 # obstore: main
137 # obstore: main
135 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
138 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -141,6 +144,7 b' Actual Test (bare push version)'
141 searching for changes
144 searching for changes
142 no changes found
145 no changes found
143 1 new obsolescence markers
146 1 new obsolescence markers
147 obsoleted 1 changesets
144 ## post pull state
148 ## post pull state
145 # obstore: main
149 # obstore: main
146 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
150 28b51eb45704506b5c603decd6bf7ac5e0f6a52f e5ea8f9c73143125d36658e90ef70c6d2027a5b7 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
@@ -735,6 +735,7 b' Test setup'
735 adding file changes
735 adding file changes
736 added 1 changesets with 0 changes to 1 files (+1 heads)
736 added 1 changesets with 0 changes to 1 files (+1 heads)
737 2 new obsolescence markers
737 2 new obsolescence markers
738 obsoleted 1 changesets
738 (run 'hg heads' to see heads, 'hg merge' to merge)
739 (run 'hg heads' to see heads, 'hg merge' to merge)
739 $ hg log --hidden -G
740 $ hg log --hidden -G
740 o changeset: 2:7a230b46bf61
741 o changeset: 2:7a230b46bf61
@@ -205,6 +205,7 b' Actual testing'
205 # unbundling: adding file changes
205 # unbundling: adding file changes
206 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
206 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
207 # unbundling: 2 new obsolescence markers
207 # unbundling: 2 new obsolescence markers
208 # unbundling: obsoleted 1 changesets
208 # unbundling: (run 'hg heads' to see heads)
209 # unbundling: (run 'hg heads' to see heads)
209
210
210 $ testrevs 'desc("C-A")'
211 $ testrevs 'desc("C-A")'
@@ -366,6 +367,7 b' problematic)'
366 # unbundling: adding file changes
367 # unbundling: adding file changes
367 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
368 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
368 # unbundling: 1 new obsolescence markers
369 # unbundling: 1 new obsolescence markers
370 # unbundling: obsoleted 1 changesets
369 # unbundling: (run 'hg heads' to see heads)
371 # unbundling: (run 'hg heads' to see heads)
370
372
371 bundling multiple revisions
373 bundling multiple revisions
@@ -957,6 +959,7 b' Actual testing'
957 # unbundling: adding file changes
959 # unbundling: adding file changes
958 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
960 # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
959 # unbundling: 6 new obsolescence markers
961 # unbundling: 6 new obsolescence markers
962 # unbundling: obsoleted 3 changesets
960 # unbundling: (run 'hg heads' to see heads)
963 # unbundling: (run 'hg heads' to see heads)
961
964
962 Bundle multiple revisions
965 Bundle multiple revisions
@@ -1057,6 +1060,7 b' Bundle multiple revisions'
1057 # unbundling: adding file changes
1060 # unbundling: adding file changes
1058 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1061 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1059 # unbundling: 7 new obsolescence markers
1062 # unbundling: 7 new obsolescence markers
1063 # unbundling: obsoleted 2 changesets
1060 # unbundling: (run 'hg heads' to see heads)
1064 # unbundling: (run 'hg heads' to see heads)
1061
1065
1062 * top one and initial precursors
1066 * top one and initial precursors
@@ -1122,6 +1126,7 b' Bundle multiple revisions'
1122 # unbundling: adding file changes
1126 # unbundling: adding file changes
1123 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1127 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1124 # unbundling: 6 new obsolescence markers
1128 # unbundling: 6 new obsolescence markers
1129 # unbundling: obsoleted 3 changesets
1125 # unbundling: (run 'hg heads' to see heads)
1130 # unbundling: (run 'hg heads' to see heads)
1126
1131
1127 * top one and one of the split
1132 * top one and one of the split
@@ -1189,6 +1194,7 b' Bundle multiple revisions'
1189 # unbundling: adding file changes
1194 # unbundling: adding file changes
1190 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1195 # unbundling: added 2 changesets with 2 changes to 2 files (+2 heads)
1191 # unbundling: 7 new obsolescence markers
1196 # unbundling: 7 new obsolescence markers
1197 # unbundling: obsoleted 2 changesets
1192 # unbundling: (run 'hg heads' to see heads)
1198 # unbundling: (run 'hg heads' to see heads)
1193
1199
1194 * all
1200 * all
@@ -613,6 +613,7 b' Do not warn about new head when the new '
613 adding file changes
613 adding file changes
614 added 1 changesets with 1 changes to 1 files (+1 heads)
614 added 1 changesets with 1 changes to 1 files (+1 heads)
615 1 new obsolescence markers
615 1 new obsolescence markers
616 obsoleted 1 changesets
616
617
617 test relevance computation
618 test relevance computation
618 ---------------------------------------
619 ---------------------------------------
@@ -68,5 +68,6 b' Actual testing'
68 adding file changes
68 adding file changes
69 added 1 changesets with 1 changes to 1 files (+1 heads)
69 added 1 changesets with 1 changes to 1 files (+1 heads)
70 1 new obsolescence markers
70 1 new obsolescence markers
71 obsoleted 1 changesets
71
72
72 $ cd ../..
73 $ cd ../..
@@ -81,5 +81,6 b' Actual testing'
81 adding file changes
81 adding file changes
82 added 1 changesets with 1 changes to 1 files (+1 heads)
82 added 1 changesets with 1 changes to 1 files (+1 heads)
83 2 new obsolescence markers
83 2 new obsolescence markers
84 obsoleted 2 changesets
84
85
85 $ cd ../..
86 $ cd ../..
@@ -81,6 +81,7 b' Actual testing'
81 adding file changes
81 adding file changes
82 added 1 changesets with 1 changes to 1 files (+1 heads)
82 added 1 changesets with 1 changes to 1 files (+1 heads)
83 2 new obsolescence markers
83 2 new obsolescence markers
84 obsoleted 2 changesets
84
85
85 $ cd ../..
86 $ cd ../..
86
87
@@ -82,5 +82,6 b' Actual testing'
82 adding file changes
82 adding file changes
83 added 1 changesets with 1 changes to 1 files (+1 heads)
83 added 1 changesets with 1 changes to 1 files (+1 heads)
84 2 new obsolescence markers
84 2 new obsolescence markers
85 obsoleted 2 changesets
85
86
86 $ cd ../..
87 $ cd ../..
@@ -88,5 +88,6 b' Actual testing'
88 adding file changes
88 adding file changes
89 added 1 changesets with 1 changes to 1 files (+1 heads)
89 added 1 changesets with 1 changes to 1 files (+1 heads)
90 3 new obsolescence markers
90 3 new obsolescence markers
91 obsoleted 3 changesets
91
92
92 $ cd ../..
93 $ cd ../..
@@ -74,5 +74,6 b' Actual testing'
74 adding file changes
74 adding file changes
75 added 1 changesets with 1 changes to 1 files (+1 heads)
75 added 1 changesets with 1 changes to 1 files (+1 heads)
76 2 new obsolescence markers
76 2 new obsolescence markers
77 obsoleted 1 changesets
77
78
78 $ cd ../..
79 $ cd ../..
@@ -73,5 +73,6 b' Actual testing'
73 adding file changes
73 adding file changes
74 added 1 changesets with 1 changes to 1 files (+1 heads)
74 added 1 changesets with 1 changes to 1 files (+1 heads)
75 2 new obsolescence markers
75 2 new obsolescence markers
76 obsoleted 1 changesets
76
77
77 $ cd ../..
78 $ cd ../..
@@ -94,5 +94,6 b' Actual testing'
94 adding file changes
94 adding file changes
95 added 1 changesets with 1 changes to 1 files (+1 heads)
95 added 1 changesets with 1 changes to 1 files (+1 heads)
96 4 new obsolescence markers
96 4 new obsolescence markers
97 obsoleted 2 changesets
97
98
98 $ cd ../..
99 $ cd ../..
@@ -65,5 +65,6 b' Actual testing'
65 adding file changes
65 adding file changes
66 added 1 changesets with 1 changes to 1 files (+1 heads)
66 added 1 changesets with 1 changes to 1 files (+1 heads)
67 1 new obsolescence markers
67 1 new obsolescence markers
68 obsoleted 1 changesets
68
69
69 $ cd ../..
70 $ cd ../..
@@ -83,5 +83,6 b' Actual testing'
83 adding file changes
83 adding file changes
84 added 2 changesets with 2 changes to 2 files (+1 heads)
84 added 2 changesets with 2 changes to 2 files (+1 heads)
85 2 new obsolescence markers
85 2 new obsolescence markers
86 obsoleted 2 changesets
86
87
87 $ cd ../..
88 $ cd ../..
@@ -86,5 +86,6 b' Actual testing'
86 adding file changes
86 adding file changes
87 added 2 changesets with 2 changes to 2 files (+1 heads)
87 added 2 changesets with 2 changes to 2 files (+1 heads)
88 2 new obsolescence markers
88 2 new obsolescence markers
89 obsoleted 2 changesets
89
90
90 $ cd ../..
91 $ cd ../..
@@ -70,5 +70,6 b' Actual testing'
70 adding file changes
70 adding file changes
71 added 2 changesets with 2 changes to 2 files (+1 heads)
71 added 2 changesets with 2 changes to 2 files (+1 heads)
72 1 new obsolescence markers
72 1 new obsolescence markers
73 obsoleted 1 changesets
73
74
74 $ cd ../../
75 $ cd ../../
@@ -70,6 +70,7 b' Actual testing'
70 adding file changes
70 adding file changes
71 added 2 changesets with 2 changes to 2 files (+1 heads)
71 added 2 changesets with 2 changes to 2 files (+1 heads)
72 1 new obsolescence markers
72 1 new obsolescence markers
73 obsoleted 1 changesets
73
74
74 $ cd ../..
75 $ cd ../..
75
76
@@ -94,5 +94,6 b' Actual testing'
94 adding file changes
94 adding file changes
95 added 2 changesets with 2 changes to 2 files (+1 heads)
95 added 2 changesets with 2 changes to 2 files (+1 heads)
96 2 new obsolescence markers
96 2 new obsolescence markers
97 obsoleted 2 changesets
97
98
98 $ cd ../..
99 $ cd ../..
@@ -94,5 +94,6 b' Actual testing'
94 adding file changes
94 adding file changes
95 added 2 changesets with 2 changes to 2 files (+1 heads)
95 added 2 changesets with 2 changes to 2 files (+1 heads)
96 2 new obsolescence markers
96 2 new obsolescence markers
97 obsoleted 2 changesets
97
98
98 $ cd ../..
99 $ cd ../..
@@ -75,5 +75,6 b' Actual testing'
75 adding file changes
75 adding file changes
76 added 1 changesets with 1 changes to 1 files (+1 heads)
76 added 1 changesets with 1 changes to 1 files (+1 heads)
77 2 new obsolescence markers
77 2 new obsolescence markers
78 obsoleted 1 changesets
78
79
79 $ cd ../..
80 $ cd ../..
@@ -118,5 +118,6 b' Actual testing (existing branch only)'
118 adding file changes
118 adding file changes
119 added 1 changesets with 1 changes to 1 files
119 added 1 changesets with 1 changes to 1 files
120 1 new obsolescence markers
120 1 new obsolescence markers
121 obsoleted 1 changesets
121
122
122 $ cd ../..
123 $ cd ../..
@@ -103,5 +103,6 b' Actual testing'
103 adding file changes
103 adding file changes
104 added 1 changesets with 1 changes to 1 files
104 added 1 changesets with 1 changes to 1 files
105 1 new obsolescence markers
105 1 new obsolescence markers
106 obsoleted 1 changesets
106
107
107 $ cd ../..
108 $ cd ../..
@@ -92,5 +92,6 b' Actual testing'
92 adding file changes
92 adding file changes
93 added 1 changesets with 1 changes to 1 files (+1 heads)
93 added 1 changesets with 1 changes to 1 files (+1 heads)
94 3 new obsolescence markers
94 3 new obsolescence markers
95 obsoleted 1 changesets
95
96
96 $ cd ../..
97 $ cd ../..
@@ -1665,6 +1665,7 b' racing commit push a new head obsoleting'
1665 adding file changes
1665 adding file changes
1666 added 1 changesets with 1 changes to 1 files (+1 heads)
1666 added 1 changesets with 1 changes to 1 files (+1 heads)
1667 1 new obsolescence markers
1667 1 new obsolescence markers
1668 obsoleted 1 changesets
1668 (run 'hg heads .' to see heads, 'hg merge' to merge)
1669 (run 'hg heads .' to see heads, 'hg merge' to merge)
1669 $ hg -R ./client-other pull
1670 $ hg -R ./client-other pull
1670 pulling from ssh://user@dummy/server
1671 pulling from ssh://user@dummy/server
@@ -1674,6 +1675,7 b' racing commit push a new head obsoleting'
1674 adding file changes
1675 adding file changes
1675 added 1 changesets with 1 changes to 1 files (+1 heads)
1676 added 1 changesets with 1 changes to 1 files (+1 heads)
1676 1 new obsolescence markers
1677 1 new obsolescence markers
1678 obsoleted 1 changesets
1677 (run 'hg heads .' to see heads, 'hg merge' to merge)
1679 (run 'hg heads .' to see heads, 'hg merge' to merge)
1678 $ hg -R ./client-racy pull
1680 $ hg -R ./client-racy pull
1679 pulling from ssh://user@dummy/server
1681 pulling from ssh://user@dummy/server
@@ -1770,6 +1772,7 b' Pushing'
1770 remote: adding file changes
1772 remote: adding file changes
1771 remote: added 1 changesets with 0 changes to 1 files (+1 heads)
1773 remote: added 1 changesets with 0 changes to 1 files (+1 heads)
1772 remote: 1 new obsolescence markers
1774 remote: 1 new obsolescence markers
1775 remote: obsoleted 1 changesets
1773
1776
1774 $ release $TESTTMP/watchfile
1777 $ release $TESTTMP/watchfile
1775
1778
General Comments 0
You need to be logged in to leave comments. Login now