##// END OF EJS Templates
singlehead: introduce option to restrict to public changes...
Joerg Sonnenberger -
r46712:4d5e2fd5 default
parent child Browse files
Show More
@@ -1079,6 +1079,11 b' coreconfigitem('
1079 )
1079 )
1080 coreconfigitem(
1080 coreconfigitem(
1081 b'experimental',
1081 b'experimental',
1082 b'single-head-per-branch:public-changes-only',
1083 default=False,
1084 )
1085 coreconfigitem(
1086 b'experimental',
1082 b'sshserver.support-v2',
1087 b'sshserver.support-v2',
1083 default=False,
1088 default=False,
1084 )
1089 )
@@ -2254,7 +2254,13 b' class localrepository(object):'
2254 accountclosed = singleheadsub.get(
2254 accountclosed = singleheadsub.get(
2255 b"account-closed-heads", False
2255 b"account-closed-heads", False
2256 )
2256 )
2257 scmutil.enforcesinglehead(repo, tr2, desc, accountclosed)
2257 if singleheadsub.get(b"public-changes-only", False):
2258 filtername = b"immutable"
2259 else:
2260 filtername = b"visible"
2261 scmutil.enforcesinglehead(
2262 repo, tr2, desc, accountclosed, filtername
2263 )
2258 if hook.hashook(repo.ui, b'pretxnclose-bookmark'):
2264 if hook.hashook(repo.ui, b'pretxnclose-bookmark'):
2259 for name, (old, new) in sorted(
2265 for name, (old, new) in sorted(
2260 tr.changes[b'bookmarks'].items()
2266 tr.changes[b'bookmarks'].items()
@@ -2189,12 +2189,12 b' def nodesummaries(repo, nodes, maxnumnod'
2189 return _(b"%s and %d others") % (first, len(nodes) - maxnumnodes)
2189 return _(b"%s and %d others") % (first, len(nodes) - maxnumnodes)
2190
2190
2191
2191
2192 def enforcesinglehead(repo, tr, desc, accountclosed=False):
2192 def enforcesinglehead(repo, tr, desc, accountclosed, filtername):
2193 """check that no named branch has multiple heads"""
2193 """check that no named branch has multiple heads"""
2194 if desc in (b'strip', b'repair'):
2194 if desc in (b'strip', b'repair'):
2195 # skip the logic during strip
2195 # skip the logic during strip
2196 return
2196 return
2197 visible = repo.filtered(b'visible')
2197 visible = repo.filtered(filtername)
2198 # possible improvement: we could restrict the check to affected branch
2198 # possible improvement: we could restrict the check to affected branch
2199 bm = visible.branchmap()
2199 bm = visible.branchmap()
2200 for name in bm:
2200 for name in bm:
@@ -26,8 +26,13 b''
26 * The memory footprint per changeset during pull/unbundle
26 * The memory footprint per changeset during pull/unbundle
27 operations has been further reduced.
27 operations has been further reduced.
28
28
29
29 == New Experimental Features ==
30 == New Experimental Features ==
30
31
32 * `experimental.single-head-per-branch:public-changes-only` can be used
33 restrict the single head check to public revision. This is useful for
34 overlay repository that have both a publishing and non-publishing view
35 of the same storage.
31
36
32
37
33 == Bug Fixes ==
38 == Bug Fixes ==
@@ -277,7 +277,7 b" Because of previous test, we'll also pus"
277 c_aL0
277 c_aL0
278 c_aM0
278 c_aM0
279
279
280 Let's make a new head and push everythin. The server feedback will mention
280 Let's make a new head and push everything. The server feedback will mention
281 exactly one new head because c_aM0 is closed.
281 exactly one new head because c_aM0 is closed.
282
282
283 $ hg up 'desc("c_aG0")'
283 $ hg up 'desc("c_aG0")'
@@ -291,3 +291,98 b' exactly one new head because c_aM0 is cl'
291 adding manifests
291 adding manifests
292 adding file changes
292 adding file changes
293 added 3 changesets with 3 changes to 3 files (+1 heads)
293 added 3 changesets with 3 changes to 3 files (+1 heads)
294 $ cd ..
295
296
297 Test that singe-head-per-branch can be restricted to public changes
298 -------------------------------------------------------------------
299
300 $ hg clone -r 49003e504178 single-head-server public-only
301 adding changesets
302 adding manifests
303 adding file changes
304 added 9 changesets with 9 changes to 9 files
305 1 new obsolescence markers
306 new changesets ea207398892e:49003e504178 (9 drafts)
307 updating to branch branch_A
308 9 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 $ cd public-only
310 $ cat <<EOF >> .hg/hgrc
311 > [phases]
312 > publish = no
313 > [experimental]
314 > single-head-per-branch = yes
315 > single-head-per-branch:public-changes-only = yes
316 > EOF
317 > hg phase -p :
318 $ hg update 'desc("c_aG0")'
319 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
320 $ mkcommit c_dO0
321 created new head
322 $ hg log -G
323 @ changeset: 9:8058fd35cc2b
324 | branch: branch_A
325 | tag: tip
326 | parent: 7:a33fb808fb4b
327 | user: test
328 | date: Thu Jan 01 00:00:00 1970 +0000
329 | summary: c_dO0
330 |
331 | o changeset: 8:49003e504178
332 |/| branch: branch_A
333 | | parent: 7:a33fb808fb4b
334 | | parent: 3:840af1c6bc88
335 | | user: test
336 | | date: Thu Jan 01 00:00:00 1970 +0000
337 | | summary: c_aI0
338 | |
339 o | changeset: 7:a33fb808fb4b
340 | | branch: branch_A
341 | | user: test
342 | | date: Thu Jan 01 00:00:00 1970 +0000
343 | | summary: c_aG0
344 | |
345 o | changeset: 6:99a2dc242c5d
346 | | user: test
347 | | date: Thu Jan 01 00:00:00 1970 +0000
348 | | summary: c_dF1
349 | |
350 o | changeset: 5:6ed1df20edb1
351 |\ \ parent: 4:9bf953aa81f6
352 | | | parent: 2:286d02a6e2a2
353 | | | user: test
354 | | | date: Thu Jan 01 00:00:00 1970 +0000
355 | | | summary: c_dE0
356 | | |
357 | o | changeset: 4:9bf953aa81f6
358 | | | parent: 1:134bc3852ad2
359 | | | user: test
360 | | | date: Thu Jan 01 00:00:00 1970 +0000
361 | | | summary: c_dD0
362 | | |
363 | | o changeset: 3:840af1c6bc88
364 | | | branch: branch_A
365 | | | parent: 0:ea207398892e
366 | | | user: test
367 | | | date: Thu Jan 01 00:00:00 1970 +0000
368 | | | summary: c_aC0
369 | | |
370 o | | changeset: 2:286d02a6e2a2
371 |/ / user: test
372 | | date: Thu Jan 01 00:00:00 1970 +0000
373 | | summary: c_dB0
374 | |
375 o | changeset: 1:134bc3852ad2
376 |/ user: test
377 | date: Thu Jan 01 00:00:00 1970 +0000
378 | summary: c_dA0
379 |
380 o changeset: 0:ea207398892e
381 user: test
382 date: Thu Jan 01 00:00:00 1970 +0000
383 summary: ROOT
384
385 $ hg phase -p .
386 abort: rejecting multiple heads on branch "branch_A"
387 (2 heads: 49003e504178 8058fd35cc2b)
388 [255]
General Comments 0
You need to be logged in to leave comments. Login now