Bases: object
The common interface that all repository classes implement.
Parameters: |
|
---|
Other options depend on the concrete repository class.
Repository instances are callable. For each of them:
repo(rev)
will take all the steps necessary so that its local directory is a clone of the remote source, at the specified revision. If needed and possible The revision format depends on the concrete class, but it is passed as a str.
Remove unwanted untracked files.
This default implementation removes Python object files and (resulting) empty directories. Subclasses are supposed to implement better vcs-specific behaviours. It is important for release-related options that this cleaning does not appear as a local modification.
Make it so that the target directory is at the prescribed revision.
The target directory need not to be initialized: this method will “clone” it from the remote source (whatever that means in the considered VCS).
This method can fail under various circumstances, for instance if the wanted revision does not exist locally and offline mode has been selected.
Raises: |
|
---|
Must be implemented in concrete subclasses
True if path exists and is versioned under this vcs.
Common implementation based on vcs_control_dir class attribute.
Return universal identifier for parent nodes, aka current revisions.
There might be more than one with some VCSes (ex: pending merge in hg).
Parameters: | pip_compatible – if True, only pip compatible revision specifications are returned, depending on the VCS type. |
---|
Bases: subprocess.CalledProcessError
Class to easily signal errors in initial cloning.
Bases: subprocess.CalledProcessError
Specific class for errors occurring during updates of existing repos.
Bases: anybox.recipe.odoo.vcs.base.BaseRepo
Represent a Bazaar branch tied to a reference branch.
Ensure that target_dir is a branch of url at specified revision.
If target_dir already exists, does a simple pull. Offline-mode: no branch nor pull, but update. In all cases, an attempt to update is performed before any pull
Special case: if the ‘merge’ option is True, merge revision into current branch.
True iff revspec is a fixed revision number.
Valid revision numbers are integers separated by dots.
Parameters: | fixed – if True, it is further checked that integers are positive. |
---|
Return current revision.
Parameters: |
|
---|
This method will not detect pending merges, but uncommitted_changes() will, and that is enough for freeze/extract features.
Return a dict of paths from standard conf (or the given file-like)
Reference: http://doc.bazaar.canonical.com/bzr.0.18/configuration.htm
>>> from pprint import pprint
>>> branch = BzrBranch('', '')
>>> pprint(branch.parse_conf(StringIO(os.linesep.join([
... "parent_location = /some/path",
... "submit_location = /other/path"]))))
{'parent_location': '/some/path', 'submit_location': '/other/path'}
Convert revision number (revno) to globally unique revision id.
Parameters: | revspec (str) – any revision specification |
---|---|
Returns str: | revision id specification (directly usable as -r argument) |
Reset branch.conf to state before latest update_conf changes.
Only changes done through the same instance are taken into account.
Update branch.conf.
Return bool: | True if parent URL has changed (see lp:1320198) |
---|
Bases: anybox.recipe.odoo.vcs.base.BaseRepo
Represent a Git clone tied to a reference branch/commit/tag.
Make it so that the target directory is at the prescribed revision.
Special case: if the ‘merge’ option is True, merge revision into current branch.
Parse git version string and store the resulting tuple on self.
Returns: | the parsed version tuple |
---|
Only the first 3 digits are kept. This is good enough for the few version dependent cases we need, and coarse enough to avoid more complicated parsing.
Some real-life examples:
>>> GitRepo.init_git_version('git version 1.8.5.3')
(1, 8, 5)
>>> GitRepo.init_git_version('git version 1.7.2.5')
(1, 7, 2)
Seen on MacOSX (not on MacPorts):
>>> GitRepo.init_git_version('git version 1.8.5.2 (Apple Git-48)')
(1, 8, 5)
Seen on Windows (Tortoise Git):
>>> GitRepo.init_git_version('git version 1.8.4.msysgit.0')
(1, 8, 4)
A compiled version:
>>> GitRepo.init_git_version('git version 2.0.3.2.g996b0fd')
(2, 0, 3)
Rewrapped by hub, it has two lines:
>>> GitRepo.init_git_version('git version 1.7.9\nhub version 1.11.0')
(1, 7, 9)
This one does not exist, allowing us to prove that this method actually governs the git_version property
>>> GitRepo.init_git_version('git version 0.0.666')
(0, 0, 666)
>>> GitRepo('', '').git_version
(0, 0, 666)
Expected exceptions:
>>> try: GitRepo.init_git_version('invalid')
... except ValueError: pass
After playing with it, we must reset it so that tests can run with the proper detected one, if needed:
>>> GitRepo.init_git_version(None)
Wrap a subprocess call with logging
Parameters: | meth – the calling method to use. |
---|
Return full hash of parent nodes.
Parameters: | pip_compatible – ignored, all Git revspecs are pip compatible |
---|
Query remote repo about given ref.
Returns: | ('tag', sha) if ref is a tag in remote ('branch', sha) if ref is branch (aka “head”) in remote (None, ref) if ref does not exist in remote. This happens notably if ref if a commit sha (they can’t be queried) |
---|
Bases: anybox.recipe.odoo.vcs.base.BaseRepo
Ensure that target_dir is a clone of url at specified revision.
If target_dir already exists, does a simple pull. Offline-mode: no clone nor pull, but update.
True if revstr is a fixed revision that we already have.
Check is done for known tags (except tip) and known nodes identified by a long enough (12 char) prefix of their hexadecimal hash.
Summary of collision cases for hg up:
In theory, a 12 char hexadecimal node hash could be shadowed by an incoming tag. But also, any tag could be overridden. These are considered to be fixed anyway for convenience in sensible use-cases.
People having CI robots involving tags that do get overridden by a third party upstream should complain to upstream for utterly bad practices.
Return full hash of parent nodes.
Parameters: | pip_compatible – ignored, all Hg revspecs are pip compatible |
---|
Update hgrc paths section if needed.
Old paths are kept in renamed form: buildout_save_%d.
Bases: anybox.recipe.odoo.vcs.base.BaseRepo
Ensure that target_dir is a branch of url at specified revision.
If target_dir already exists, does a simple pull. Offline-mode: no branch nor pull, but update.