##// END OF EJS Templates
push: support config option to require revs be specified when running push...
Kyle Lippincott -
r43433:5617b748 default
parent child Browse files
Show More
@@ -5615,6 +5615,9 b' def push(ui, repo, dest=None, **opts):'
5615 5615 raise error.Abort(
5616 5616 _(b'default push revset for path evaluates to an empty set')
5617 5617 )
5618 elif ui.configbool(b'commands', b'push.require-revs'):
5619 raise error.Abort(_(b'no revisions specified to push'),
5620 hint=_(b'did you mean "hg push -r ."?'))
5618 5621
5619 5622 repo._subtoppath = dest
5620 5623 try:
@@ -228,6 +228,9 b' coreconfigitem('
228 228 b'commands', b'grep.all-files', default=False, experimental=True,
229 229 )
230 230 coreconfigitem(
231 b'commands', b'push.require-revs', default=False,
232 )
233 coreconfigitem(
231 234 b'commands', b'resolve.confirm', default=False,
232 235 )
233 236 coreconfigitem(
@@ -442,6 +442,14 b' effect and style see :hg:`help color`.'
442 442 Show status of files in the working directory after successful commit.
443 443 (default: False)
444 444
445 ``push.require-revs``
446 Require revisions to push be specified using one or more mechanisms such as
447 specifying them positionally on the command line, using ``-r``, ``-b``,
448 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
449 configuration. If this is enabled and revisions are not specified, the
450 command aborts.
451 (default: False)
452
445 453 ``resolve.confirm``
446 454 Confirm before performing action if no filename is passed.
447 455 (default: False)
@@ -348,3 +348,55 b' SEC: check for unsafe ssh url'
348 348 [255]
349 349
350 350 $ [ ! -f owned ] || echo 'you got owned'
351
352 Test `commands.push.require-revs`
353 ---------------------------------
354
355 $ hg clone -q test-revflag test-require-revs-source
356 $ hg init test-require-revs-dest
357 $ cd test-require-revs-source
358 $ cat >> .hg/hgrc << EOF
359 > [paths]
360 > default = ../test-require-revs-dest
361 > [commands]
362 > push.require-revs=1
363 > EOF
364 $ hg push
365 pushing to $TESTTMP/test-require-revs-dest
366 abort: no revisions specified to push
367 (did you mean "hg push -r ."?)
368 [255]
369 $ hg push -r 0
370 pushing to $TESTTMP/test-require-revs-dest
371 searching for changes
372 adding changesets
373 adding manifests
374 adding file changes
375 added 1 changesets with 1 changes to 1 files
376 $ hg bookmark -r 0 push-this-bookmark
377 (test that -B (bookmark) works for specifying "revs")
378 $ hg push -B push-this-bookmark
379 pushing to $TESTTMP/test-require-revs-dest
380 searching for changes
381 no changes found
382 exporting bookmark push-this-bookmark
383 [1]
384 (test that -b (branch) works for specifying "revs")
385 $ hg push -b default
386 pushing to $TESTTMP/test-require-revs-dest
387 searching for changes
388 abort: push creates new remote head [0-9a-f]+! (re)
389 (merge or see 'hg help push' for details about pushing new heads)
390 [255]
391 (demonstrate that even though we don't have anything to exchange, we're still
392 showing the error)
393 $ hg push
394 pushing to $TESTTMP/test-require-revs-dest
395 abort: no revisions specified to push
396 (did you mean "hg push -r ."?)
397 [255]
398 $ hg push --config paths.default:pushrev=0
399 pushing to $TESTTMP/test-require-revs-dest
400 searching for changes
401 no changes found
402 [1]
General Comments 0
You need to be logged in to leave comments. Login now