FreshPorts & src commits to branches

Mathieu Arnold mat at freebsd.org
Wed Aug 19 12:47:28 UTC 2020


On Tue, Aug 18, 2020 at 09:23:03AM -0400, Dan Langille wrote:
> On Tue, Aug 18, 2020, at 3:44 AM, Adriaan de Groot wrote:
> > On Tuesday, 18 August 2020 03:19:26 CEST Dan Langille wrote:
> > > I am quickly realizing that in order for FreshPorts to track src commits it
> > > needs to query every branch. There does not seem to be any other way to
> > > know that a commit ocurred on stable/12 without a checkout of stable/12
> > 
> > If you have the full repo (e.g. a normal clone) then you might be able to use 
> > something along this line:
> > 
> > git log --branches --since 2020-08-16 --source --raw | grep ^commit
> > 
> > (the important bit is --branches to include all of them, and --source to 
> > include the source). I don't have a FreeBSD repo at hand, but my work-repo 
> > (which currently has some other branch checked out) gives me this kind of 
> > output:
> > 
> > commit 36cefe3be10c707a2cdfaedd14fddee5cda31f50 hotfix-3.2.28.2
> > commit eb44d0c6be18c1ced99d5a8c1b1a6a1a0e653be2 hotfix-3.2.28.2
> > commit 24efce0c1d5601a77ad2b919cf0cf387231add76 calamares
> > commit 5db4195b7e3e507a34f84e041b15a4aa86ed32da hotfix-3.2.28.2
> > commit 34946ecdee90584caf255fcca732c021e1dc1832 hotfix-3.2.28.2
> > commit 1a7b2668dc1e341b493990b99e9a0cc4530d32cd hotfix-3.2.28.2
> > 
> > This gives me branches for each commit hash in the given range. The branches 
> > you see mentioned here diverged before the date range given. I can't say 
> > anything about performance, here -- my little test repo only has ~8000 commits 
> > going back six years.
> > 
> > (Turning this command-line into a collection of libgit calls is left as an 
> > exercise for the reader)
> 
> FYI, FreshPorts is using devel/py-pygit2 which uses devel/libgit2 :)
> 
> After a git pull, I same up with this:
> 
> [dan at devgit-ingress01:~/src/freebsd/freebsd] $ git log --branches --since 2020-08-17 --source --raw | grep ^commit
> commit ef1942cafc385f2ebc7e4a7a5f5679bb1a4b0d78	stable/12
> commit 3889b52f5c73875df9a28180c4b1b4a07bf0042a	stable/12
> commit 9fc2a101135102074391b6ff28b825b082410ffa	master
> commit a9a7211e27bfe2bec89b08899b977a4677728d97	master
> ... several lines omitted from this paste
> commit 5853f38da725897c25a505ce62675e31aca27f26	master
> commit 1b47d5c7b7fb338daf65ccf05b9df0d9e93d11ae	stable/12
> 
> Let's try a date time in there:
> 
> [dan at devgit-ingress01:~/src/freebsd/freebsd] $ git log --branches --since "2020-08-17 23:00:00" --source --raw | grep ^commit
> commit ef1942cafc385f2ebc7e4a7a5f5679bb1a4b0d78	stable/12 
> commit 3889b52f5c73875df9a28180c4b1b4a07bf0042a	stable/12
> 
> Those were both at 23:40 yesterday.
> 
> The current approach is: I have this commit, show me all the commits after that: hash..HEAD
> 
> That works on a branch-by-branch basis.
> 
> 
> This may be a potential issues: The --since & --branches approach requires a date/timestamp. If we always use the timestamp of the last time we asked, will we skip over commits?

Well, I would run something like --since '2 weeks ago' and ignore what
commits you already have.  It will maybe work, or not, it will probably
depend on wether we allow branches or out of order commits, or...

It would probably be safer to do for each branch, look at the commits in
the <last>...<branch> range, which would get you all the commits,
proably even if we allow merge commits.

> Humor me while I contemplate URLs.  
> 
> The 3889b52f5c73875df9a28180c4b1b4a07bf0042a commit translates to:
> 
> https://github.com/freebsd/freebsd/blob/stable/12/sys/sys/ata.h

Well, nom the 3889b52f5c73875df9a28180c4b1b4a07bf0042a commit translates
to 

https://github.com/freebsd/freebsd/blob/3889b52f5c73875df9a28180c4b1b4a07bf0042a/sys/sys/ata.h

The URL you have is for the head of the stable/12 branch.

> The format seems to be:
> 
> https://github.com/freebsd/freebsd - URL to repo
> 
> blob - some abstraction
> 
> stable/12 - branch
> 
> sys/sys/ata.h - path to file
> 
> Compared to head/master:
> 
> https://github.com/freebsd/freebsd/blob/master/sys/sys/ata.h
> 
> The only difference: stable/12 -> master : very straight forward.

What do you need the github url for?

-- 
Mathieu Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-git/attachments/20200819/b09c27be/attachment.sig>


More information about the freebsd-git mailing list