Part of lp.codehosting.puller.worker View In Hierarchy
BranchMirrorer
safely makes mirrors of branches.
A BranchMirrorer
has a BranchOpenPolicy
to tell it which URLs are safe
to accesss and whether or not to follow branch references.
The mirrorer knows how to follow branch references, create new mirrors, update existing mirrors, determine stacked-on branches and the like.
Public methods are open
and mirror
.
Method | __init__ | Construct a branch opener with 'policy'. |
Method | createDestinationBranch | Create a destination branch for 'source_branch'. |
Method | openDestinationBranch | Open or create the destination branch at 'destination_url'. |
Method | updateBranch | Bring 'dest_branch' up-to-date with 'source_branch'. |
Method | mirror | Mirror 'source_branch' to 'destination_url'. |
Method | open | Undocumented |
Parameters | policy | A BranchOpenPolicy that tells us what URLs are valid
and similar things. |
log | A callable which can be called with a format string and arguments to log messages in the scheduler, or None, in which case log messages are discarded. |
Creates a branch at 'destination_url' that is a mirror of 'source_branch'. Any content already at 'destination_url' will be deleted.
Parameters | source_branch | The Bazaar branch that will be mirrored. |
destination_url | The place to make the destination branch. This URL must point to a writable location. | |
Returns | The destination branch. |
Parameters | source_branch | The Bazaar branch that will be mirrored. |
destination_url | The place to make the destination branch. This URL must point to a writable location. | |
Returns | The opened or created branch. |
This method pulls 'source_branch' into 'dest_branch' and sets the stacked-on URL of 'dest_branch' to match 'source_branch'.
This method assumes that 'source_branch' and 'dest_branch' both have the same format.