diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-12-02 12:39:36 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-12-16 09:55:14 +0200 |
commit | 13a3087d5afcfcee308595b2c224ffe5cdc12c94 (patch) | |
tree | f93d6fed8c9a19215f911c66e63e6848324d9053 /gbp | |
parent | 63a5a1aedb5e14e6d32a942b2a4c6de42b14a8f2 (diff) |
GitRepository: implemet checkout_files() method
Makes it possible to only checkout certain files from a branch, instead
of switching to the branch. Add a new method instead of extending
checkout() in order to keep it consistent. That is, otherwise checkout()
would have totally different outcome depending on whether paths were
defined of not.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/git/repository.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 6559921..a920817 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -924,6 +924,19 @@ class GitRepository(object): """ self._git_command("checkout", ["--quiet", treeish]) + def checkout_files(self, treeish, paths): + """ + Checkout files from a treeish. Branch will not be changed. + + @param treeish: the treeish from which to check out files + @type treeish: C{str} + @param paths: list of files to checkout + @type treeish: C{list} of C{str} + """ + args = GitArgs("--quiet", treeish) + args.add_true(paths, '--', paths) + self._git_command("checkout", args.args) + def has_treeish(self, treeish): """ Check if the repository has the treeish object I{treeish}. |