public class NoteDbUpdateManager extends Object implements AutoCloseable
Instances are one-time-use. Handles updating both the change repo and the All-Users repo for any affected changes, with proper ordering.
To see the state that would be applied prior to executing the full sequence of updates, use
stage().
| Modifier and Type | Class and Description |
|---|---|
static interface |
NoteDbUpdateManager.Factory |
static class |
NoteDbUpdateManager.OpenRepo |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ChangeDraftUpdate draftUpdate) |
void |
add(ChangeUpdate update)
Add an update to the list of updates to execute.
|
void |
close() |
void |
deleteChange(Change.Id id) |
org.eclipse.jgit.lib.BatchRefUpdate |
execute() |
org.eclipse.jgit.lib.BatchRefUpdate |
execute(boolean dryrun) |
void |
flush() |
NoteDbUpdateManager |
setChangeRepo(org.eclipse.jgit.lib.Repository repo,
org.eclipse.jgit.revwalk.RevWalk rw,
org.eclipse.jgit.lib.ObjectInserter ins,
ChainedReceiveCommands cmds) |
NoteDbUpdateManager |
setPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert)
Set a push certificate for the push that originally triggered this NoteDb update.
|
NoteDbUpdateManager |
setRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident) |
NoteDbUpdateManager |
setRefLogMessage(String message) |
public void close()
close in interface AutoCloseablepublic NoteDbUpdateManager setChangeRepo(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, ChainedReceiveCommands cmds)
public NoteDbUpdateManager setRefLogMessage(String message)
public NoteDbUpdateManager setRefLogIdent(org.eclipse.jgit.lib.PersonIdent ident)
public NoteDbUpdateManager setPushCertificate(org.eclipse.jgit.transport.PushCertificate pushCert)
The pusher will not necessarily have specified any of the NoteDb refs explicitly, such as
when processing a push to refs/for/master. That's fine; this is just passed to the
underlying BatchRefUpdate, and the implementation decides what to do with it.
The cert should be associated with the main repo. There is currently no way of associating a
push cert with the All-Users repo, since it is not currently possible to update draft
changes via push.
pushCert - push certificate; may be null.public void add(ChangeUpdate update)
Updates should only be added to the manager after all mutations have been made, as this method may eagerly access the update.
update - the update to add.public void add(ChangeDraftUpdate draftUpdate)
public void deleteChange(Change.Id id)
public void flush()
throws IOException
IOExceptionpublic org.eclipse.jgit.lib.BatchRefUpdate execute()
throws IOException
IOExceptionpublic org.eclipse.jgit.lib.BatchRefUpdate execute(boolean dryrun)
throws IOException
IOException