aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts/dch.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-23 08:44:53 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-23 08:44:53 +0100
commit53b5af5898a8be27ec5f03d88e3e6c76232f6292 (patch)
tree9e9a7fd0c52f36cf44ee3f2ace2171f83f051aab /gbp/scripts/dch.py
parent06ae8c94198ff280e01d0e04658e096c4dc55711 (diff)
dch: Allow to run from subdirectory
Resolves #1
Diffstat (limited to 'gbp/scripts/dch.py')
-rw-r--r--gbp/scripts/dch.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 59e920b1..18e86de7 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -423,8 +423,10 @@ def main(argv):
return ExitCodes.parse_error
try:
+ old_cwd = os.path.abspath(os.path.curdir)
try:
- repo = DebianGitRepository('.')
+ repo = DebianGitRepository('.', toplevel=False)
+ os.chdir(repo.path)
except GitRepositoryError:
raise GbpError("%s is not a git repository" % (os.path.abspath('.')))
@@ -566,6 +568,8 @@ def main(argv):
if str(err):
gbp.log.err(err)
ret = 1
+ finally:
+ os.chdir(old_cwd)
return ret