##// END OF EJS Templates
merge: add commands.merge.require-rev to require an argument to hg merge...
Kyle Lippincott -
r44325:8caec25f default
parent child Browse files
Show More
@@ -4888,6 +4888,13 b' def merge(ui, repo, node=None, **opts):'
4888 node = scmutil.revsingle(repo, node).node()
4888 node = scmutil.revsingle(repo, node).node()
4889
4889
4890 if not node and not abort:
4890 if not node and not abort:
4891 if ui.configbool(b'commands', b'merge.require-rev'):
4892 raise error.Abort(
4893 _(
4894 b'configuration requires specifying revision to merge '
4895 b'with'
4896 )
4897 )
4891 node = repo[destutil.destmerge(repo)].node()
4898 node = repo[destutil.destmerge(repo)].node()
4892
4899
4893 if opts.get(b'preview'):
4900 if opts.get(b'preview'):
@@ -228,6 +228,9 b' coreconfigitem('
228 b'commands', b'grep.all-files', default=False, experimental=True,
228 b'commands', b'grep.all-files', default=False, experimental=True,
229 )
229 )
230 coreconfigitem(
230 coreconfigitem(
231 b'commands', b'merge.require-rev', default=False,
232 )
233 coreconfigitem(
231 b'commands', b'push.require-revs', default=False,
234 b'commands', b'push.require-revs', default=False,
232 )
235 )
233 coreconfigitem(
236 coreconfigitem(
@@ -442,6 +442,12 b' effect and style see :hg:`help color`.'
442 Show status of files in the working directory after successful commit.
442 Show status of files in the working directory after successful commit.
443 (default: False)
443 (default: False)
444
444
445 ``merge.require-rev``
446 Require that the revision to merge the current commit with be specified on
447 the command line. If this is enabled and a revision is not specified, the
448 command aborts.
449 (default: False)
450
445 ``push.require-revs``
451 ``push.require-revs``
446 Require revisions to push be specified using one or more mechanisms such as
452 Require revisions to push be specified using one or more mechanisms such as
447 specifying them positionally on the command line, using ``-r``, ``-b``,
453 specifying them positionally on the command line, using ``-r``, ``-b``,
@@ -44,9 +44,10 b' Should fail because > 2 heads:'
44 (run 'hg heads .' to see heads, specify rev with -r)
44 (run 'hg heads .' to see heads, specify rev with -r)
45 [255]
45 [255]
46
46
47 Should succeed:
47 Should succeed (we're specifying commands.merge.require-rev=True just to test
48 that it allows merge to succeed if we specify a revision):
48
49
49 $ hg merge 2
50 $ hg merge 2 --config commands.merge.require-rev=True
50 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
51 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
51 (branch merge, don't forget to commit)
52 (branch merge, don't forget to commit)
52 $ hg id -Tjson
53 $ hg id -Tjson
@@ -63,6 +64,13 b' Should succeed:'
63 ]
64 ]
64 $ hg commit -mm1
65 $ hg commit -mm1
65
66
67 Should fail because we didn't specify a revision (even though it would have
68 succeeded without this):
69
70 $ hg merge --config commands.merge.require-rev=True
71 abort: configuration requires specifying revision to merge with
72 [255]
73
66 Should succeed - 2 heads:
74 Should succeed - 2 heads:
67
75
68 $ hg merge -P
76 $ hg merge -P
@@ -88,6 +96,13 b' Should succeed - 2 heads:'
88 }
96 }
89 ]
97 ]
90
98
99 Should fail because we didn't specify a revision (even though it would have
100 failed without this due to being on tip, but this check comes first):
101
102 $ hg merge --config commands.merge.require-rev=True
103 abort: configuration requires specifying revision to merge with
104 [255]
105
91 Should fail because at tip:
106 Should fail because at tip:
92
107
93 $ hg merge
108 $ hg merge
@@ -4,6 +4,8 b' test merge-tools configuration - mostly '
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [ui]
5 > [ui]
6 > merge=
6 > merge=
7 > [commands]
8 > merge.require-rev=True
7 > EOF
9 > EOF
8 $ hg init repo
10 $ hg init repo
9 $ cd repo
11 $ cd repo
@@ -1908,6 +1910,7 b' checked strictly.'
1908 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1910 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1909 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1911 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1910 [1]
1912 [1]
1913 (Testing that commands.merge.require-rev doesn't break --abort)
1911 $ hg merge --abort -q
1914 $ hg merge --abort -q
1912
1915
1913 (for ui.merge, ignored unintentionally)
1916 (for ui.merge, ignored unintentionally)
General Comments 0
You need to be logged in to leave comments. Login now