Open glensc opened 8 years ago
Sounds like a great idea! I was not aware of git notes until now.
It would be nice to keep the current append_branch_info (in case people want it) and add an analogous one to store the same info into git notes.
yes. previous one should stay.
but for git notes first need some boilerplate code for having api to add git notes, i wonder what namespace to use, default commits
or svn2git
or agito
or ...?
will you write yourself that code? or give some pointers how to implement? btw, i noticed you create commits.db
-- so could just post process with extra script to build git notes.
for now i've just created simple script:
import shelve
commits = shelve.open("commits.db")
for path, commit in commits.items():
print("git notes add %s -m '%s'" % (commit, path))
which can be used as:
python ../agito/notes.py | sh
Oh, does dulwich not have an API for git notes? Maybe you could contact the package owners and implement a notes API for it. I'd prefer to do everything through the dulwich API if possible.
well. it might have or have not, just not looked into its internals. internal git implementation, git notes is just just a another ref where target is file, content is message, and commit id and commit message is irrelevant:
$ git log refs/notes/commits
commit bdf45fc5018eb3467a8e54cc3aa92c4055649bf3
Author: Elan Ruusamäe <glen@delfi.ee>
Date: Sun Mar 27 20:16:24 2016 +0300
Notes added by 'git notes add'
commit f54010b333f7e0c8eddc8e298d55be5f65096973
Author: Elan Ruusamäe <glen@delfi.ee>
Date: Sun Mar 27 20:16:24 2016 +0300
Notes added by 'git notes add'
$ git show bdf45fc5018eb3467a8e54cc3aa92c4055649bf3
commit bdf45fc5018eb3467a8e54cc3aa92c4055649bf3
Author: Elan Ruusamäe <glen@delfi.ee>
Date: Sun Mar 27 20:16:24 2016 +0300
Notes added by 'git notes add'
diff --git a/89/515a8dd7a3a1d6046cfab36374c1e80d9e03d0 b/89/515a8dd7a3a1d6046cfab36374c1e80d9e03d0
new file mode 100644
index 0000000..8ecd636
--- /dev/null
+++ b/89/515a8dd7a3a1d6046cfab36374c1e80d9e03d0
@@ -0,0 +1 @@
+/trunk@97860
$ git show 89515a8dd7a3a1d6046cfab36374c1e80d9e03d0
<the actual commit to what git note was added>
$ git clone barerepo.git tmp; cd tmp
$ git fetch origin refs/notes/*:refs/notes/*
$ git checkout -b notes refs/notes/commits
Switched to a new branch 'notes'
$ ls
01/ 0d/ 1c/ 31/ 3c/ 43/ 49/ 52/ 61/ 76/ 82/ 91/ 98/ a2/ ae/ ba/ c0/ ca/ d6/ e1/ e7/ f6/
04/ 11/ 20/ 32/ 3e/ 44/ 4a/ 58/ 65/ 79/ 83/ 93/ 99/ a3/ b0/ bc/ c2/ ce/ dd/ e2/ ee/ f8/
08/ 18/ 2c/ 36/ 3f/ 45/ 4f/ 5c/ 69/ 7b/ 89/ 94/ 9b/ a5/ b1/ bd/ c6/ d2/ df/ e4/ f3/ fe/
09/ 1a/ 2e/ 3a/ 41/ 48/ 50/ 5d/ 6a/ 81/ 8d/ 95/ a0/ a6/ b8/ bf/ c9/ d4/ e0/ e5/ f5/
$ cat 89/515a8dd7a3a1d6046cfab36374c1e80d9e03d0
/trunk@97860
$
you'll get the idea...
meanwhile i requested git notes support to dulwich https://github.com/jelmer/dulwich/issues/427
what you think of a filter
append_branch_info
but store into git notes?i generally do not like the git repo noise, but having it git notes makes it not so intrusive, git notes are not fetched by default, so ones who wish to fetch the info can do the notes fetch to see them