Package gbp :: Package rpm :: Module git :: Class RpmGitRepository

[hide private]
[frames] | no frames]

# Class RpmGitRepository

                      object --+
                               |
    git.repository.GitRepository --+
                                   |
                                  RpmGitRepository

A git repository that holds the source of an RPM package

Instance Methods | [hide private]

__init__(self, path) x.__init__(...) initializes x; see help(type(x)) for signature |

find_version(self, format, str_fields) Check if a certain version is stored in this repo and return the SHA1 of the related commit. |

`Bool`

has_pristine_tar_branch(self) Wheter the repo has a pristine-tar branch. |

Inherited from `git.repository.GitRepository`: `archive`, `clean`, `collect_garbage`, `force_head`, `get_author_info`, `get_config`, `is_clean`, `is_empty`, `rev_parse`, `status`

Inherited from `git.repository.GitRepository` (private): `_check_bare`, `_cmd_has_feature`, `_git_command`, `_git_getoutput`, `_git_inout`, `_status`

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Branches and Merging

Inherited from `git.repository.GitRepository`: `branch_contains`, `create_branch`, `delete_branch`, `get_branch`, `get_local_branches`, `get_merge_base`, `get_merge_branch`, `get_remote_branches`, `get_upstream_branch`, `has_branch`, `is_fast_forward`, `merge`, `rename_branch`, `set_branch`, `set_upstream_branch`, `update_ref`

Inherited from `git.repository.GitRepository` (private): `_get_branches`

Tags
Inherited from `git.repository.GitRepository`: `create_tag`, `delete_tag`, `describe`, `find_branch_tag`, `find_tag`, `get_tags`, `has_tag`, `move_tag`, `verify_tag`
Trees
Inherited from `git.repository.GitRepository`: `checkout`, `get_obj_type`, `has_treeish`, `list_tree`, `make_tree`, `write_tree`
Remote Repositories
Inherited from `git.repository.GitRepository`: `add_remote_repo`, `fetch`, `get_remote_repos`, `get_remotes`, `has_remote_repo`, `pull`, `push`, `push_tag`, `remove_remote_repo`
Files
Inherited from `git.repository.GitRepository`: `add_files`, `list_files`, `remove_files`, `write_file`
Comitting
Inherited from `git.repository.GitRepository`: `commit_all`, `commit_dir`, `commit_files`, `commit_staged`, `commit_tree` Inherited from `git.repository.GitRepository` (private): `_commit`
Commit Information
Inherited from `git.repository.GitRepository`: `get_commit_info`, `get_commits`, `get_subject`, `grep_log`, `show`
Patches
Inherited from `git.repository.GitRepository`: `apply_patch`, `diff`, `diff_status`, `format_patches`
Submodules
Inherited from `git.repository.GitRepository`: `add_submodule`, `get_submodules`, `has_submodules`, `update_submodules`

Class Methods | [hide private]

Repository Creation
Inherited from `git.repository.GitRepository`: `clone`, `create`

Static Methods | [hide private]

version_to_tag(format, str_fields) Generate a tag from a given format and a version |

_sanitize_tag(tag) sanitize a version so git accepts it as a tag |

Inherited from `git.repository.GitRepository`: `strip_sha1`

Instance Variables | [hide private]

Inherited from `git.repository.GitRepository` (private): `_bare`, `_path`

Properties | [hide private]

| pristine_tar_branch The name of the pristine-tar branch, whether it already exists or not.
Inherited from `git.repository.GitRepository`: `bare`, `branch`, `git_dir`, `head`, `path`, `tags` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, path)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Raises:
  - `GitRepositoryError` - on git errors GitRepositoryError is raised by all methods.
Overrides: object.__init__
  (inherited documentation)

### find_version(self, format, str_fields)

Check if a certain version is stored in this repo and return the SHA1 of the related commit. That is, an annotated tag is dereferenced to the commit object it points to.

Parameters:
  - `format` (`str`) - tag pattern
  - `str_fields` (`dict` of `str`) - arguments for format string ('upstreamversion', 'release', 'vendor'...)
Returns:
  sha1 of the commit the tag references to

### version_to_tag(format, str_fields)
Static Method

Generate a tag from a given format and a version

Parameters:
  - `format` (`str`) - tag pattern
  - `str_fields` (`dict` of `str`) - arguments for format string ('upstreamversion', 'release', 'vendor'...)
Returns:
  version tag

      >>> RpmGitRepository.version_to_tag("packaging/%(version)s", dict(epoch='0', upstreamversion='0~0'))
      'packaging/0%0_0'
      >>> RpmGitRepository.version_to_tag("%(vendor)s/v%(version)s", dict(upstreamversion='1.0', release='2', vendor="myvendor"))
      'myvendor/v1.0-2'

### _sanitize_tag(tag)
Static Method

sanitize a version so git accepts it as a tag

    >>> RpmGitRepository._sanitize_tag("0.0.0")
    '0.0.0'
    >>> RpmGitRepository._sanitize_tag("0.0~0")
    '0.0_0'
    >>> RpmGitRepository._sanitize_tag("0:0.0")
    '0%0.0'
    >>> RpmGitRepository._sanitize_tag("0%0~0")
    '0%0_0'

### has_pristine_tar_branch(self)

Wheter the repo has a pristine-tar branch.

Returns: `Bool`
  `True` if the repo has pristine-tar commits already, `False` otherwise

Property Details | [hide private]

### pristine_tar_branch

The name of the pristine-tar branch, whether it already exists or not.

Get Method:
  unreachable.pristine_tar_branch(self) - The name of the pristine-tar branch, whether it already exists or not.