From 4e1f6817919effbd2eb9a4bc218fac5041445440 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 9 Jul 2012 10:52:36 +0300 Subject: [PATCH] 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 38e5a75..c03d39f 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 77113f9..acb0bb1 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -31,7 +31,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" -- 2.7.4