From c769b660911de03a8bf7ffb6e22991646b486790 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 9 Jul 2012 10:52:36 +0300 Subject: buildpackage: new "working copy" choices for --git-export Add support for building different kind of "working copies", when using the --git-export option: - 'WC.TRACKED': only use files that are already tracked - 'WC.UNTRACKED': use untracked files, too - 'WC.IGNORED': also add files that'd normally be ignored Using '--git-export=WC' beaves like before. Signed-off-by: Markus Lehtonen --- gbp/scripts/buildpackage.py | 8 +++++--- gbp/scripts/common/buildpackage.py | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index 419f01d..6a9f33b 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -35,7 +35,7 @@ from gbp.deb.upstreamsource import DebianUpstreamSource from gbp.errors import GbpError import gbp.log import gbp.notifications -from gbp.scripts.common.buildpackage import (index_name, wc_name, +from gbp.scripts.common.buildpackage import (index_name, wc_names, git_archive_submodules, git_archive_single, dump_tree, write_wc, drop_index) @@ -122,8 +122,10 @@ def write_tree(repo, options): if options.export_dir: if options.export == index_name: tree = repo.write_tree() - elif options.export == wc_name: - tree = write_wc(repo) + elif options.export in wc_names: + tree = write_wc(repo, + force=wc_names[options.export]['force'], + untracked=wc_names[options.export]['untracked']) else: tree = options.export if not repo.has_treeish(tree): diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py index 7aeebe0..111512f 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -32,7 +32,10 @@ import gbp.log # when we want to reference the index in a treeish context we call it: index_name = "INDEX" # when we want to reference the working copy in treeish context we call it: -wc_name = "WC" +wc_names = {'WC': {'force': True, 'untracked': True}, + 'WC.TRACKED': {'force': False, 'untracked': False}, + 'WC.UNTRACKED': {'force': False, 'untracked': True}, + 'WC.IGNORED': {'force': True, 'untracked': True}} # index file name used to export working copy wc_index = ".git/gbp_index" -- cgit v1.2.3