notes¶

For git-notes(1).

Overview¶

Manage git notes using GitNotesManager (collection-level) and GitNoteCmd (per-note operations).

Examples¶

Add a note to the current commit (object_sha defaults to HEAD), then list notes:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.notes.add(message='This is a note')
''
>>> notes = git.notes.ls()
>>> len(notes) >= 1
True

Operate on a note through its Cmd object — show it, append to it, remove it:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.notes.add(message='Reviewed by Alice')
''
>>> note = git.notes.ls()[0]
>>> note.show()
'Reviewed by Alice\n'
>>> note.append(message='Additional info')
''
>>> note.remove()
'...'

Prune notes attached to objects that no longer exist:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.notes.prune()
''

API Reference¶

class libvcs.cmd.git.GitNotesManager
¶
class libvcs.cmd.git.GitNotesManager
¶

Bases: object

Traverse and manage git notes with ORM-like filtering via QueryList.

class libvcs.cmd.git.GitNoteCmd
¶
class libvcs.cmd.git.GitNoteCmd
¶

Bases: object

Run git commands targeting a specific note.