From 56b0ba2f793030a7af9db670b5767d889de05b73 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 12 Aug 2014 15:57:41 +0200 Subject: [PATCH] debian_build.py: Only reset the latest git commit if it was added. --- debian_build.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/debian_build.py b/debian_build.py index e8d448c..ef70420 100755 --- a/debian_build.py +++ b/debian_build.py @@ -543,8 +543,10 @@ if __name__ == '__main__': 'This is not allowed, failing...') # .. and update changelog if we trust the package + add_changelog_entry = False if do_autoincrement: logger.info('This is an autoincrementing project.') + add_changelog_entry = True try: logger.debug(subprocess.check_call([BIN_DCH, '-i', 'Released by jenkins.'])) logger.debug(subprocess.check_call([BIN_GIT_DCH, '-R', '-a', '--spawn-editor=none'])) @@ -566,7 +568,8 @@ if __name__ == '__main__': logger.info('Project is not respected by autoincrement.') cl = changelog.Changelog() cl.parse_changelog(open('debian/changelog')) - if new_dist != cl.distributions or new_version != cl.full_version: + add_changelog_entry = new_dist != cl.distributions or new_version != cl.full_version + if add_changelog_entry: cmd = [ BIN_DCH, '--newversion', @@ -653,8 +656,9 @@ if __name__ == '__main__': # .. remove last commit (the one where we added the changelog entry) # FIXME: when 'merge': reset only on original branch? # change checkout back to original branch? - logger.info('Reset repository to HEAD~1 to revert develop changelog entry.') - logger.debug(gitrepo.git.reset('--soft', 'HEAD~1')) + if add_changelog_entry: + logger.info('Reset repository to HEAD~1 to revert develop changelog entry.') + logger.debug(gitrepo.git.reset('--soft', 'HEAD~1')) # .. and finally handle the result if ret: -- 2.39.5