From fee45b0acd4f9539c438fc6d9d457b64f55928ee Mon Sep 17 00:00:00 2001 From: Guido Guenther Date: Sun, 7 Oct 2007 13:53:46 +0200 Subject: handle versions containing epochs --- git-dch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/git-dch b/git-dch index 64637852..10d27387 100755 --- a/git-dch +++ b/git-dch @@ -78,11 +78,15 @@ def head_commit(): def snapshot_version(version): """ get the current release and snapshot version - @FIXME: this causes trouble with epochs + Format is ~.gbp """ try: - (release, suffix) = version.split('~', 1) - snapshot = int(suffix.split('.',1)[0]) + (release, suffix) = version.rsplit('~', 1) + (snapshot, commit) = suffix.split('.', 1) + if not commit.startswith('gbp'): + raise ValueError + else: + snapshot = int(snapshot) except ValueError: # not a snapshot release release = version snapshot = 0 -- cgit v1.2.3