FreshPorts / git_proc_commit

Tools for processing git commits one at a time.
BSD 2-Clause "Simplified" License
0 stars 1 forks source link

Add git-to-freshports script #1

Closed skozlov404 closed 4 years ago

skozlov404 commented 4 years ago

Event: EuroBSDCon 2019 Hackathon Sponsored by: Intel Corporation

dlangille commented 4 years ago

Thank you for your work on this. I hope to test it soon.

dlangille commented 4 years ago

This worked on my laptop. Thank you.

skozlov404 commented 4 years ago

Great news, thanks for letting me know. If you find any bugs please notify me, I'll try to fix it.

Sergey

On Fri, Sep 20, 2019, 17:42 Dan Langille notifications@github.com wrote:

This worked on my laptop. Thank you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FreshPorts/git_proc_commit/pull/1?email_source=notifications&email_token=ACOSHKOUHWR6LOFAZBJAKZLQKTVPNA5CNFSM4IYWBLO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7HDF3Y#issuecomment-533607151, or mute the thread https://github.com/notifications/unsubscribe-auth/ACOSHKKJ7YRXWJKUUTIFAETQKTVPNANCNFSM4IYWBLOQ .

dlangille commented 4 years ago

I started working on processing the XML.

Please include the hash into the XML. I know it is in the filename, but we should also put it into the XML.

I would also like repo name in there. Just hardcode it to ports for now please.

EDIT: after working on the code more: It looks like we should add a COMMIT clause, where we once had MESSAGE:

        <COMMIT Hash="f2bfe60090b840b6d99a3288c0b745843cefcfe1" EncodingLosses="false" Repository="ports"/>

Let's put it between PEOPLE and FILES.

dlangille commented 4 years ago

We have the first commit loaded into the database. Further processing is required, but I managed to get this hacking done on the train from Lillehammer to Oslo airport.

freshports=# select id, message_id, committer, description  from commit_log order by id desc limit 2;
   id   |                  message_id                  | committer |                                 description                                  
--------+----------------------------------------------+-----------+------------------------------------------------------------------------------
 766918 | f2bfe60090b840b6d99a3288c0b745843cefcfe1     | feld      | net-mgmt/unifi5: Update to 5.11.46                                          +
        |                                              |           |                                                                             +
        |                                              |           | Also pull in port improvements from glewis@ to enable customizing which Java+
        |                                              |           | that Unifi runs with                                                        +
        |                                              |           |                                                                             +
        |                                              |           | PR:             240016
 766908 | 201909201136.x8KBaUna058053@repo.freebsd.org | jhale     | Update security/*gpgme* to 1.13.1
(2 rows)

freshports=# 
jpmens commented 4 years ago

@dlangille you shouldn't have to say put "this element" between "that and that"; XML is agnostic to that as the proper parsers won't care. On the contrary: it typically isn't possible to define how the elements/tags are output. :-)

dlangille commented 4 years ago

Agreed.

The placement is for humans reading it when debugging. We are writing a file. We can control the placement.

skozlov404 commented 4 years ago

I would also like repo name in there. Just hardcode it to ports for now please.

It's already there, in the OS section. It defaults to 'ports', but you can change is by using cmdline flags to the script. In the next pull request it's also used in the COMMIT tag #2

EDIT: after working on the code more: It looks like we should add a COMMIT clause, where we once had MESSAGE:

        <COMMIT Hash="f2bfe60090b840b6d99a3288c0b745843cefcfe1" EncodingLosses="false" Repository="ports"/>

Let's put it between PEOPLE and FILES.

Done in the next pull request #2 I wasn't sure what EncodingLosses have to be, so just hard-coded it for now.

skozlov404 commented 4 years ago

@dlangille you shouldn't have to say put "this element" between "that and that"; XML is agnostic to that as the proper parsers won't care. On the contrary: it typically isn't possible to define how the elements/tags are output. :-)

The parser I'm using preserves order, although it's not strictly enforced by the XML standard. I believe most of parsers/emitters preserve order because it's important in HTML.

dlangille commented 4 years ago

See https://news.freshports.org/2020/06/21/git-the-next-freshports-project/