[PATCH WIP] etc: Add "tarball" snippet.

  • Done
  • quality assurance status badge
Details
3 participants
  • Brett Gilio
  • Pierre Neidhardt
  • zimoun
Owner
unassigned
Submitted by
Brett Gilio
Severity
normal
B
B
Brett Gilio wrote on 25 Dec 2019 06:48
(address . guix-patches@gnu.org)
87h81pymzj.fsf@gnu.org
This patch is actually a WIP. I'd ideally like it if it could also
detect the addition of `(git-file-name ...)` and add that to the
sub-header commit message portion, but I am not so talented in Yasnippet
creation :).

If anybody wants to take a crack at it, please do. But I think this
snippet will prove useful as we will almost always have unstable
tarballs coming into our sources.
From f4b14a47e3741c107ea83e2717674c8a032f8dba Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@gnu.org>
Date: Tue, 24 Dec 2019 23:42:27 -0600
Subject: [PATCH] etc: Add "tarball" snippet.

* etc/snippets/text-mode/guix-commit-message-unstable-tarball: New file.
---
.../text-mode/guix-commit-message-unstable-tarball | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 etc/snippets/text-mode/guix-commit-message-unstable-tarball

Toggle diff (17 lines)
diff --git a/etc/snippets/text-mode/guix-commit-message-unstable-tarball b/etc/snippets/text-mode/guix-commit-message-unstable-tarball
new file mode 100644
index 0000000000..e82f522e54
--- /dev/null
+++ b/etc/snippets/text-mode/guix-commit-message-unstable-tarball
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: guix-commit-message-unstable-tarball
+# key: tarball
+# condition: git-commit-mode
+# --
+gnu: $1: Don't use unstable tarball.
+
+* `(car (magit-staged-files))` ($1)[source]: Download using GIT-FETCH.
\ No newline at end of file
--
2.24.1
B
B
Brett Gilio wrote on 25 Dec 2019 07:42
[PATCH WIP v2] etc: Add "tarball" snippet
(address . 38738@debbugs.gnu.org)
87eewszz20.fsf@gnu.org
This is a revised (but still ugly) revision of the original snippet that
I think details somewhat what I mean by detecting the relevant changes
to these types of commits and adding something to indicate this. I'd
really like to see this be on the same line, instead of having two
[source] blocks. But, as noted before, not a pro in Yasnippet by any
means. :) (not to mention, the elisp is not good, but it is a rough
concept).
From 488faa8cabd298bb2d00f91a6056b26227089060 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@gnu.org>
Date: Wed, 25 Dec 2019 00:38:37 -0600
Subject: [PATCH] etc: Add "tarball" snippet

* etc/snippets/text-mode/guix-commit-message-unstable-tarball: New file.
---
.../guix-commit-message-unstable-tarball | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 etc/snippets/text-mode/guix-commit-message-unstable-tarball

Toggle diff (28 lines)
diff --git a/etc/snippets/text-mode/guix-commit-message-unstable-tarball b/etc/snippets/text-mode/guix-commit-message-unstable-tarball
new file mode 100644
index 0000000000..6a41d2156a
--- /dev/null
+++ b/etc/snippets/text-mode/guix-commit-message-unstable-tarball
@@ -0,0 +1,20 @@
+# -*- mode: snippet -*-
+# name: guix-commit-message-unstable-tarball
+# key: tarball
+# condition: git-commit-mode
+# --
+gnu: $1: Don't use unstable tarball.
+
+* `(car (magit-staged-files))` ($1): Modify package to use stable git references.
+`(with-temp-buffer
+ (magit-git-wash #'magit-diff-wash-diffs
+ "diff" "--staged")
+ (beginning-of-buffer)
+ (when (search-forward "(method git-fetch" nil 'noerror)
+ (print "[source]: Use GIT-FETCH.")))`
+`(with-temp-buffer
+ (magit-git-wash #'magit-diff-wash-diffs
+ "diff" "--staged")
+ (beginning-of-buffer)
+ (when (search-forward "(file-name (git-file-name" nil 'noerror)
+ (print "[source]: Use GIT-FILE-NAME.")))`
--
2.24.1
P
P
Pierre Neidhardt wrote on 27 Feb 2020 11:14
(name . Brett Gilio)(address . brettg@gnu.org)(address . 38738@debbugs.gnu.org)
87wo8872wt.fsf@ambrevar.xyz
Looks good to me!

If you want to print only one "[source]:" I suggest the following,
untested:

* `(car (magit-staged-files))` ($1): Modify package to use stable git references.
`(with-temp-buffer
(magit-git-wash #'magit-diff-wash-diffs
"diff" "--staged")
(let ((source-block "[source]: ")
(wrote-source-block? nil))
(beginning-of-buffer)
(when (search-forward "(method git-fetch" nil 'noerror)
(setq wrote-source-block? t)
(print (format "%sUse GIT-FETCH." source-block)))
(beginning-of-buffer)
(when (search-forward "(file-name (git-file-name" nil 'noerror)
(print (format "%sUse GIT-FILE-NAME." (if wrote-source-block? "" "[source]:"))))))`


--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl5XloIACgkQm9z0l6S7
zH/56wgAmSr/Dwtash1hoaudTY1DMtgfEpcbZNFuoUpOZDcbF16JN88wn6DjEth+
FZde8Q35OYdkWbNufzf9Xl9cZT89pS+oH8OFpq6oYyX6kXT6JFXJ6UGDt8B0pQmY
geE6ampU3VaLh0nwGqpV8CjyIR4VT4TcG7iRDWyECSdDsbVrpq1S8NHh6UNCLFSl
FSMyUMcz6JirZcz21W0pk4fvviCDxCGLuU7bM+ylxKciGu2+zveyFGWKyk9yuLrC
3+dbMO30AJqFlqcC+6+RXRD8qjvE2yKBOxSQ71aPaiuHgkRojfSZSYXPsLcF32db
kWgdLLhr+FkqGK3bHKN0+pTZmacmpw==
=w1Z+
-----END PGP SIGNATURE-----

Z
Z
zimoun wrote on 12 Apr 2022 12:40
Re: bug#38738: [PATCH WIP] etc: Add "tarball" snippet.
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
864k2y37pz.fsf_-_@gmail.com
Hi,


On Thu, 27 Feb 2020 at 11:14, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

The last interaction of this patch #38738 [1] from 2 years, 6 weeks, 2
days ago ends with:

Toggle quote (2 lines)
> Looks good to me!

and since it is still a WIP, I propose to close it.





Cheers,
simon
Z
Z
zimoun wrote on 19 May 2022 23:20
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
86ilq18bid.fsf_-_@gmail.com
Hi,

On Tue, 12 Apr 2022 at 12:40, zimoun <zimon.toutoune@gmail.com> wrote:
Toggle quote (9 lines)
> On Thu, 27 Feb 2020 at 11:14, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>
> The last interaction of this patch #38738 [1] from 2 years, 6 weeks, 2
> days ago ends with:
>
>> Looks good to me!
>
> and since it is still a WIP, I propose to close it.

Therefore, I am closing.


Cheers,
simon
Closed
?