-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit: support
.committemplate
based on changed files
Summary: See the test for an example. This can be useful to set templates for sub-projects in a larger project. Reviewed By: zzl0 Differential Revision: D49781544 fbshipit-source-id: ce9336c0b394377d3e90f135fcccf1fae01e81cb
- Loading branch information
1 parent
4bd1726
commit ff7e964
Showing
3 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#debugruntest-compatible | ||
|
||
$ newrepo | ||
$ setconfig 'committemplate.changeset={foo}\n' | ||
$ setconfig 'committemplate.foo=foo' | ||
|
||
Default commit template | ||
|
||
$ HGEDITOR=cat hg commit --config ui.allowemptycommit=true | ||
foo | ||
abort: commit message unchanged | ||
[255] | ||
|
||
$ mkdir -p x/y/z/k z/y | ||
$ touch x/y/z/k/1 x/y/z/1 x/y/1 x/1 z/y/1 | ||
$ echo 'foo = z' > x/y/z/.committemplate | ||
$ echo 'foo = y' > x/y/.committemplate | ||
$ echo 'foo = x' > x/.committemplate | ||
$ echo 'foo = root' > .committemplate | ||
|
||
When x/y/z/k/.committemplate does not exist, check parents x/y/z: | ||
|
||
$ hg add -q x/y/z/k/1 | ||
$ HGEDITOR=cat hg commit --config ui.allowemptycommit=true | ||
z | ||
abort: commit message unchanged | ||
[255] | ||
|
||
Common prefix is now y: | ||
|
||
$ hg add -q x/y/1 | ||
$ HGEDITOR=cat hg commit --config ui.allowemptycommit=true | ||
y | ||
abort: commit message unchanged | ||
[255] | ||
|
||
Common prefix is now repo root: | ||
|
||
$ hg add z/y/1 | ||
$ HGEDITOR=cat hg commit --config ui.allowemptycommit=true | ||
root | ||
abort: commit message unchanged | ||
[255] |