Monitoring commits on all branches

Dan Langille dan at langille.org
Mon Nov 23 01:48:00 UTC 2020


> On Nov 22, 2020, at 7:58 PM, Dan Langille <dan at langille.org> wrote:
> 
> Today I managed to sit down and go through the multiple scripts involved in pulling in a commit.
> 
> https://news.freshports.org/2020/11/22/git-commit-processing-how-is-it-done/
> 
> Some changes were made....
> 
>> On Nov 21, 2020, at 2:06 PM, Marc Branchaud <marcnarc at gmail.com> wrote:
>> 
>> (trimmed some of the quoting)
>> 
>> On 2020-11-21 9:11 a.m., Dan Langille wrote:
>>> On Thu, Nov 19, 2020, at 5:30 PM, Marc Branchaud wrote:
>>>> Watch out with that "git checkout branch" part: This is where a lot of
>>>> people get tripped up when they move from svn to git.  It doesn't help
>>>> that git tries to do some hand-holding here, but really git users would
>>>> benefit from simply understanding how branch names are just labels for
>>>> commit SHA IDs.  Without that understanding, people end up going down
>>>> the rabbit-hole that is the "git pull" command, a wretched hive of scum
>>>> and villainy if there ever was one.
>>> I understand the concern and I think I follow.  Within the confines of
>>> 'only wanting the files for reference, never local modification', pull and
>>> fetch might be the same for me. I'll look at fetch more.
>> 
>> "git fetch" is just the "get updates from the remote repo" part of "git pull".
>> 
>> The thing with pull is that it wants to "help" you update your local branches the "right" way.  But the "right" way really depends on how you work and how your project works.  So most advice to "do a 'git pull'" is only useful for the most general of cases.
> 
> Commits on the quarterly branch are now being automatically processed.
> 
> Now that the code is not doing 'git checkout master', which made sense on master, things are going better.
> 
> git fetch
> git checkout master
> git rebase $REMOTE/master
> 
> Now its just doing:
> 
> git pull
> git rev-list <HASH>..HEAD
> 
> This seems to be working.
> 
> However, that may change if I start doing local tags.

I just tried this.

While I understand the issue around 

[dan at devgit-ingress01:~/src/freebsd/freebsd-ports] $ git fetch
remote: Enumerating objects: 220, done.
remote: Counting objects: 100% (194/194), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 111 (delta 60), reused 100 (delta 49), pack-reused 0
Receiving objects: 100% (111/111), 18.38 KiB | 4.59 MiB/s, done.
Resolving deltas: 100% (60/60), completed with 36 local objects.
From https://github.com/freebsd/freebsd-ports
   24a927a0ef5d..bba44fef62c0  master          -> origin/master
   e3989b2f380e..9944c9cd2c35  branches/2020Q4 -> origin/branches/2020Q4
   7c20845bd227..430121ca5ac7  svn_head        -> origin/svn_head


OK, I see how I might be able to use that output, I can see which branches have new commits.


[dan at devgit-ingress01:~/src/freebsd/freebsd-ports] $ git merge
Updating 24a927a0ef5d..bba44fef62c0
Fast-forward
 audio/hpsjam/Makefile                                                   |   2 +-
 audio/hpsjam/distinfo                                                   |   6 +-
 devel/Makefile                                                          |   1 +
 devel/php80-intl/files/patch-icu68                                      | 222 ----------------------------------------
 devel/py-pytest-datadir/Makefile                                        |  27 +++++
 devel/py-pytest-datadir/distinfo                                        |   3 +
 devel/py-pytest-datadir/pkg-descr                                       |   4 +
 graphics/tiled/Makefile                                                 |   7 +-
 graphics/tiled/distinfo                                                 |   6 +-
 graphics/tiled/pkg-plist                                                |   4 +
 irc/irssi/Makefile                                                      |  81 +++++++--------
 irc/irssi/distinfo                                                      |   6 +-
 irc/irssi/files/patch-Makefile.in                                       |  22 ----
 irc/irssi/files/patch-configure.ac                                      |  15 ---
 irc/irssi/files/patch-meson.build                                       |  22 ++++
 irc/irssi/files/patch-perl-Makefile                                     |  22 ----
 irc/irssi/pkg-plist                                                     |  10 +-
 lang/php80/Makefile                                                     |   2 +-
 lang/php80/distinfo                                                     |   6 +-
 mail/mutt/Makefile                                                      |   2 +-
 mail/mutt/distinfo                                                      |   6 +-
 multimedia/mpv/Makefile                                                 |  33 +++---
 multimedia/mpv/distinfo                                                 |  10 +-
 multimedia/mpv/pkg-plist                                                |   4 +-
 net-im/signal-cli/Makefile                                              |  13 +--
 net-im/signal-cli/distinfo                                              |  14 +--
 net-im/signal-cli/pkg-plist                                             |   4 +-
 net/fb303/Makefile                                                      |  16 ++-
 net/fb303/distinfo                                                      |   6 +-
 net/fb303/files/patch-build_fbcode__builder_CMake_FBThriftLibrary.cmake |   2 +-
 net/fb303/files/patch-fb303_thrift_CMakeLists.txt                       |  22 ----
 net/fb303/pkg-plist                                                     |   4 +-
 net/geoipupdate/Makefile                                                |  23 +++--
 net/geoipupdate/distinfo                                                |  18 +++-
 net/geoipupdate/files/patch-Makefile                                    |  13 ++-
 net/netatalk3/Makefile                                                  |   2 +-
 net/netatalk3/files/patch-etc_afpd_volume.c                             |  20 ++++
 net/netatalk3/files/patch-libatalk_vfs_extattr.c                        |  19 ++++
 sysutils/rpi-firmware/Makefile                                          |   4 +-
 sysutils/rpi-firmware/distinfo                                          |   6 +-
 sysutils/rpi-firmware/pkg-plist                                         |   4 +-
 41 files changed, 265 insertions(+), 448 deletions(-)
 delete mode 100644 devel/php80-intl/files/patch-icu68
 create mode 100644 devel/py-pytest-datadir/Makefile
 create mode 100644 devel/py-pytest-datadir/distinfo
 create mode 100644 devel/py-pytest-datadir/pkg-descr
 delete mode 100644 irc/irssi/files/patch-Makefile.in
 delete mode 100644 irc/irssi/files/patch-configure.ac
 create mode 100644 irc/irssi/files/patch-meson.build
 delete mode 100644 irc/irssi/files/patch-perl-Makefile
 delete mode 100644 net/fb303/files/patch-fb303_thrift_CMakeLists.txt
 create mode 100644 net/netatalk3/files/patch-etc_afpd_volume.c
 create mode 100644 net/netatalk3/files/patch-libatalk_vfs_extattr.c


That output might also be useful for knowing what ports are affected, but really, this is what brings everything in.

'24a927a0ef5d' is taken from the 'git fetch' output but would also be the LAST_COMMIT for this branch.

[dan at devgit-ingress01:~/src/freebsd/freebsd-ports] $ git rev-list 24a927a0ef5d..HEAD
bba44fef62c062bf942dd5312128b43dbd813dcf
6a1e09447b223d078f78f7a7a9072e9842343c76
dffe7ea4b193785b7309dd161e76e9d626e12b96
f1a85af087281cfc6cd117301d7932472bd51adc
2cbf3d698dc5e2d265c8f58447f5dea3e0a9b7ee
e9e1f60c3603041bcca9dda1e95918dbfcd3e480
352ce94919051329b591ef3534541f3138e52be7
0140eb70289386ad0d2b5a660ae1108a2c6eed45
e273657ca09b1d2c862b24eb1154789f24e69ea6
7a79ec535067cd83fde3b8800509680cf1e60a27
182883a91022b14581cd951a733fd7ca1538ba73
494e0eafb5c57aadf36e6ef911f922169152cf1a
c1ff2a4159b9fd8d2199bb908a4facfb9b0e6399


Next, I tried a tag, but went over to the freebsd source repo, because it has more recent commits.

Command output is not shown.

[dan at devgit-ingress01:~/src/freebsd/freebsd] $ git tag freshports_last_commit
[dan at devgit-ingress01:~/src/freebsd/freebsd] $ git fetch
[dan at devgit-ingress01:~/src/freebsd/freebsd] $ git merge
[dan at devgit-ingress01:~/src/freebsd/freebsd] $ git rev-list freshports_last_commit..HEAD
5902bf651a44a052969477e3ed4ee0c382dd7b90
a0e591191ab3d906d2d3d1a6985d424513c69c70
8a81e9904d4c3bf58328345f958f5fa5ac3d0801
9c6918af8b7927e77d829b7226c456415c029bdf
6006818f9acd67f5b45d262ec949f0403b34100d
bdbb0128dce50974d8140ad511a1a895db205ece
bf39ccedb1130d2041d937ab6bfa0e6d32f10b68
df7e32b0f26fd7500b7c1360071ed323fb5b7639
236ac76160e57a74747dc4453961fe5bbd18d7fb
4b194b2e1ccbeb53c7b1a22169fdbcb79ef985ea
e8a0e692d11de506b18de046891293a5d03f15e2
45011cba53a65bbcaeb91dba13798d49387f34b3
2af377ccd66ed48f2ac8c3677fddfd6ad2608a7b
d97705ee7cb3e6405dd60a1d6f03d9737754593a
dbc3ee07f871a067e0d72d3463992370879a4372
7f2206c5a9f89d5e47cce05b79cfeead2b6598f5
2241a9b4d5b35fb0fb9ea0eb0f87dc7f0463edc3
b766790d1f5c8304463537f537a6955f1e0df442
cbc574bf4544f824705626383f9bef33d9a26089
3cc7c8abf47a2558fa0f1179905814ee167257b9
5844c0bcff59fd35dc2e0906bb696b17289e5e5c
e6e213967ba710191f3d5d912c9ecf70d7e26b8a
1dab84551f51bf73e9653559dd7c4aff547719b4
50db1dd05447122f5d2c1f2b60e9bab771294bea

After the last commit is processed, this gets done:

$ git tag freshports_last_commit
fatal: tag 'freshports_last_commit' already exists

Oops:

$ git tag -f freshports_last_commit
Updated tag 'freshports_last_commit' (was 4a90ed0de4e)

A compromise might be just logging the last commit somewhere so it can be derived easily if all is lost.

Mind you, this might be the same thing.

SELECT hash FROM commit_log order by id desc limit 1

.. assuming everything gets inserted into the database in the correct order.

That might work.  Just go back a few dozens commits and use that value.  If we reprocess commits, no bit deal.  They get ignored if already in the database.

-- 
Dan Langille - BSDCan / PGCon
dan at langille.org





More information about the freebsd-git mailing list