summaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-10-16 23:45:40 +0200
committerGuido Guenther <agx@sigxcpu.org>2007-10-16 23:45:40 +0200
commitafb4cf9888bd90bce55695e2cff8497d26b01d48 (patch)
tree506f3ac72d4cfb19d155c37f6598398d09a22221 /gbp
parentb1806bc331028a3cd034c33f0a05d737f921fd1c (diff)
add --export-dir and --export (Closes: #446042)
Diffstat (limited to 'gbp')
-rw-r--r--gbp/config.py14
-rw-r--r--gbp/git_utils.py13
2 files changed, 17 insertions, 10 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 694aceb7..d1686fa6 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -35,6 +35,7 @@ class GbpOptionParser(OptionParser):
'filter' : '',
'snapshot-number' : 'snapshot + 1',
'git-log' : '--no-merges',
+ 'export-dir' : '',
}
config_files=[ '/etc/git-buildpackage/gbp.conf',
os.path.expanduser('~/.gbp.conf'),
@@ -43,19 +44,18 @@ class GbpOptionParser(OptionParser):
def __parse_config_files(self):
"""parse the possible config files and set appropriate values default values"""
- parser=SafeConfigParser(self.defaults)
+ parser = SafeConfigParser(self.defaults)
parser.read(self.config_files)
- self.config=dict(parser.defaults())
+ self.config = dict(parser.defaults())
if parser.has_section(self.command):
- self.config=dict(parser.items(self.command, raw=True))
+ self.config.update(dict(parser.items(self.command, raw=True)))
def __init__(self, command, prefix='', usage=None):
- self.command=command
- self.prefix=prefix
+ self.command = command
+ self.prefix = prefix
self.__parse_config_files()
OptionParser.__init__(self, usage=usage)
-
def add_config_file_option(self, option_name, dest, help, **kwargs):
"""
set a option for the command line parser, the default is read from the config file
@@ -67,7 +67,7 @@ class GbpOptionParser(OptionParser):
@type help: string
"""
OptionParser.add_option(self,"--%s%s" % (self.prefix, option_name), dest=dest,
- default=self.config[option_name],
+ default=self.config[option_name],
help=help % self.config, **kwargs)
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index f52550b3..9cfb0ec5 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -27,10 +27,10 @@ class GitRepository(object):
raise GitRepositoryError
- def __git_getoutput(self, command):
- """Exec a git command and return the output"""
+ def __git_getoutput(self, command, args=[]):
+ """exec a git command and return the output"""
output = []
- popen = subprocess.Popen(['git', command], stdout=subprocess.PIPE)
+ popen = subprocess.Popen(['git', command] + args, stdout=subprocess.PIPE)
while popen.poll() == None:
output += popen.stdout.readlines()
ret = popen.poll()
@@ -47,6 +47,13 @@ class GitRepository(object):
return False
+ def has_treeish(self, treeish):
+ """check if the repository has the treeish object treeish"""
+ self.__check_path()
+ out, ret = self.__git_getoutput('ls-tree', [ treeish ])
+ return [ True, False ][ret != 0]
+
+
def get_branch(self):
"""on what branch is the current working copy"""
self.__check_path()