reflog implementation

Bug #842694 reported by Jelmer Vernooij
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Dulwich
Triaged
Medium
Unassigned

Bug Description

dulwich should have a implementation of the reflog

Jelmer Vernooij (jelmer)
Changed in dulwich:
importance: Wishlist → Medium
Revision history for this message
milki (milki-p) wrote :

I've worked on a reflog implementation

https://github.com/milki/dulwich/compare/reflog

A reflog is valid for any repo.refs
It can read/write the reflog format.
It provides a list interface to the log entries and a helper to access the shas by index specifier ( @{#}. I did not add access by date specifier here. There should probably be something that converts a date specifier into a unix timestamp.
It also provides a walker for each reflog.

If a log doesn't exist on get/set, a new reflog is created.

I would expect that all branch operations will need to hook into this. How should reflog writeback to file be handled?

Comments? Suggestions?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks for working on this. Seems like sensible approach. Two things :

It would make sense to separate out reading and writing of the reflog. When writing, we don't really want to parse all of the existing stuff but rather just append a line. When reading, it probably makes sense to deserialize the whole file like you're doing here. Reading shouldn't be necessary unless the user explicitly requests access to the reflog.

I don't understand what the point of ORDER_NONE is - it seems to have the same behaviour as ORDER_DATE?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

We'd indeed have to update all ref operations to update the reflog. I think we could actually do this just in the RefsContainer?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Related, do we care about removing entries from the reflog? Or would it be sufficient to just iterate over the reflog?

Revision history for this message
milki (milki-p) wrote :

I'm not sure I understand. In what situations are you thinking of for removing entries and/or iterating the reflog?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

So I'm wondering what the operations are that users would want to do on the reflog.

- Obviously, dulwich itself should be able to add entries to the reflog (preferably without reading the existing entries for performance reasons).

What are the use cases users care about? Do they actually want to have the reflog in memory or is it sufficient to just hand them an iterator over the entries in the reflog?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.