aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-buildpackage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-02-23 16:37:54 +0100
committerGuido Günther <agx@sigxcpu.org>2009-02-23 16:37:54 +0100
commitae575e3067fa448858835360386503168b3bf5d8 (patch)
tree86f4be641cc1d472e8b7d25518e530092ad75f07 /git-buildpackage
parentffbb38a82d2403d9495b24b68badd0d1fdf15e28 (diff)
Add --export=WC to export the working copy into export-dir.
Closes: #509138
Diffstat (limited to 'git-buildpackage')
-rwxr-xr-xgit-buildpackage20
1 files changed, 18 insertions, 2 deletions
diff --git a/git-buildpackage b/git-buildpackage
index b3e3bb24..57a2a931 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -25,13 +25,15 @@ import pipes
import time
import gbp.deb_utils as du
from gbp.git_utils import (GitRepositoryError, GitRepository, build_tag)
-from gbp.command_wrappers import (GitTag, Command, RunAtCommand, CommandExecFailed,
- PristineTar, RemoveTree)
+from gbp.command_wrappers import (GitTag, Command, RunAtCommand, CommandExecFailed,
+ PristineTar, RemoveTree, GitAdd)
from gbp.config import (GbpOptionParser, GbpOptionGroup)
from gbp.errors import GbpError
# 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"
def git_archive_pipe(prefix, pipe, output, treeish):
"""run the git_archive pipe"""
@@ -106,6 +108,7 @@ def pristine_tar_build_orig(repo, cp, output_dir, options):
else:
return False
+
def git_archive_build_orig(repo, cp, output_dir, options):
"""build orig using git-archive"""
# --upstream-branch was given on the command line, so use this:
@@ -122,6 +125,17 @@ def git_archive_build_orig(repo, cp, output_dir, options):
if not git_archive(cp, output_dir, upstream_tree):
raise GbpError, "Cannot create upstream tarball at '%s'" % output_dir
+
+def write_wc(repo):
+ """write out the current working copy as a treeish object"""
+ tree = None
+ os.putenv("GIT_INDEX_FILE", ".git/gbp_index")
+ GitAdd()(['-f', '.'])
+ tree = repo.write_tree()
+ os.unsetenv("GIT_INDEX_FILE")
+ return tree
+
+
def main(argv):
changelog = 'debian/changelog'
default_tree = 'HEAD'
@@ -226,6 +240,8 @@ def main(argv):
# write a tree of the index if necessary:
if options.treeish == index_name:
tree = repo.write_tree()
+ elif options.treeish == wc_name:
+ tree = write_wc(repo)
else:
tree = options.treeish
if not repo.has_treeish(tree):