Commit Graph

14 Commits

Author SHA1 Message Date
Xinglu Chen 3d15a19874
etc: committer: Amend previous commit if a copyright line was added.
Previously, the script would raise an error if a copyright line was added to a
file in gnu/packages/.  With this change, it will amend the previous commit
whenever a copyright line is added, and add the copyright line to the commit.

* etc/committer.scm.in (add-copyright-line): New procedure.
(main): Check if a copyright line was added and call ‘add-copyright-line’ if
necessary.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-09-21 15:15:52 +02:00
Sarah Morgensen 80fc776a61
etc/committer: Pass command-line arguments to main.
* etc/committer.scm.in: Call main with command line arguments.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-08-10 17:32:19 +02:00
Sarah Morgensen 73177859bc
etc/committer: Support custom commit messages.
Allow custom change commit messages by supplying a commit message and
optionally a changelog message as arguments.

* etc/committer.scm.in (break-string-with-newlines)
(custom-commit-message): New procedures.
(main)[change-commit-message*]: New sub-procedure. Use them.
(main): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-08-10 17:32:19 +02:00
Maxime Devos 50c2dcd1c9
etc: committer: Support reading G-expressions.
Some package definitions use G-expressions (see, e.g., chez-scheme).
Import (guix gexp) such that Guile knows how to read those.
Otherwise, an exception such as the following might be raised:

ERROR: In procedure read:
In procedure scm_lreadr: gnu/services/networking.scm:480:16: Unknown # object: #\~

* etc/committer.scm.in: Import (guix gexp).

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2021-08-07 14:01:20 +02:00
Ricardo Wurmus 570b3d32b9
etc: Break long lines in commit messages.
* etc/committer.scm.in (break-string): New procedure.
(change-commit-message): Use it.
2021-05-04 11:52:23 +02:00
Morgan Smith a6ac141ebb
etc/committer: Add missing newline.
* etc/committer.scm.in (main): Add newline to message.

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2021-04-12 21:42:15 +02:00
Morgan Smith d375eddda0
etc/committer: Use git plumbing instead of porcelain.
* etc/committer.scm.in (diff-info): Use "git diff-files" instead of "git diff".
(old-sexp): Use "git cat-file" instead of "git show".

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2021-04-12 21:42:15 +02:00
Ricardo Wurmus c762df5478
etc/committer: Disable diff colors.
Reported by: morgansmith on IRC.

* etc/committer.scm.in (diff-info): Invoke "git diff" with "--no-color".
2021-04-08 17:12:06 +02:00
Ricardo Wurmus 83991a34d5
etc/committer: Recompute hunks before processing changes.
* etc/committer.scm.in (main): Re-evaluate diff-info after processing
insertions.
2021-04-08 03:10:14 +02:00
Ricardo Wurmus 43fb6b765d
etc/committer: Record minimal context for hunks to avoid problems.
With zero context new definitions would be applied to the wrong location in
the file.  More context lines lead to larger hunks, though, so we use just one
line of context.

* etc/committer.scm.in (diff-info): Invoke "git diff" with one line of
context.
[info]: Merge line break and first line.
(lines-to-first-change): New procedure.
(old-sexp, new-sexp): Use it.
2021-04-08 03:10:14 +02:00
Ricardo Wurmus 56270c1275
etc/committer: Define delay duration as a variable.
* etc/committer.scm.in (%delay): New variable.
(main): Use it.
2021-04-08 03:10:14 +02:00
Ricardo Wurmus c8c3afe848
etc/committer: Handle package additions.
* etc/committer.scm.in (<hunk>)[diff]: Rename this field...
[diff-lines]: ...to this.
[definition?]: New field.
(hunk->patch): Join diff lines.
(diff-info): Do not join diff lines; record whether a hunk is a new
definition.
(commit-message): Rename this procedure...
(change-commit-message): ...to this.
(add-commit-message): New procedure.
(main): Handle new package definitions before changes.
2021-04-08 03:10:13 +02:00
Ricardo Wurmus 59fe30a3a8
etc: committer: Use EQUAL? instead of EQ? for differences.
* etc/committer.scm.in (commit-message): Use EQUAL? instead of EQ? to compute
differences because not all inputs may be symbols; some could be expressions.
2020-10-06 00:34:59 +02:00
Ricardo Wurmus 76a841cc8b
etc: Add committer script.
* etc/committer.scm.in: New file.
* configure.ac: Configure it.
2020-06-16 11:32:53 +02:00