aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/git
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-05-26 16:30:29 +0200
committerGuido Günther <agx@sigxcpu.org>2017-05-26 16:30:29 +0200
commit81c3d533a07c6602f07907b82b12d885239ca013 (patch)
tree08cd1d4b00fb5e9f27d41265470efd559560cd4b /gbp/git
parent0372be09cf6f68c4ade2e74b66cac8251d005a66 (diff)
GitRepository: add rename_file
Diffstat (limited to 'gbp/git')
-rw-r--r--gbp/git/repository.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 991b0fa0..a55c4777 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1431,6 +1431,17 @@ class GitRepository(object):
return self.strip_sha1(sha1)
else:
raise GbpError("Failed to hash %s: %s" % (filename, stderr))
+
+ def rename_file(self, old, new):
+ """
+ Rename file, directory, or symlink
+ """
+ args = GitArgs(old, new)
+ _, stderr, ret = self._git_inout('mv',
+ args.args,
+ capture_stderr=True)
+ if ret:
+ raise GbpError("Failed to move '%s' to '%s': %s" % (old, new, stderr.rstrip()))
#}
#{ Comitting