From 8934ccc7b435734ea3d06a85e0a8849274b99677 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Mon, 13 May 2019 08:58:19 +0200 Subject: [PATCH] diff against HEAD to fix #153 --- gitFunctions.py | 25 +++++++++++++++++++++++-- rtcFunctions.py | 8 +++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/gitFunctions.py b/gitFunctions.py index f5f9672..5413a50 100644 --- a/gitFunctions.py +++ b/gitFunctions.py @@ -83,6 +83,24 @@ class Commiter: isattachedtoaworkitemregex = re.compile("^\d*:.*-") findignorepatternregex = re.compile("\{([^\{\}]*)\}") + @staticmethod + def justadd(changeentry): + Commiter.handleignore() + Commiter.replaceauthor(changeentry.author, changeentry.email) + shell.execute("git add -A") + + Commiter.handle_captitalization_filename_changes() + + @staticmethod + def justcommit(changeentry): + shell.execute(Commiter.getcommitcommand(changeentry)) + Commiter.commitcounter += 1 + if Commiter.commitcounter is 30: + shouter.shout("30 Commits happend, push current branch to avoid out of memory") + Commiter.pushbranch("") + Commiter.commitcounter = 0 + shouter.shout("Commited change in local git repository") + @staticmethod def addandcommit(changeentry): Commiter.handleignore() @@ -339,8 +357,11 @@ def ignorejazzignore(repositoryfiles): class Differ: @staticmethod - def has_diff(): - return shell.execute("git diff --quiet") is 1 + def has_diff(diff_to_HEAD=False): + if diff_to_HEAD: + return shell.execute("git diff --cached --quiet") is 1 + else: + return shell.execute("git diff --quiet") is 1 class ExtensionFilter: diff --git a/rtcFunctions.py b/rtcFunctions.py index 114aa4f..c170f26 100644 --- a/rtcFunctions.py +++ b/rtcFunctions.py @@ -246,16 +246,18 @@ def acceptchangesintoworkspace(self, changeentries): "Change wasnt succesfully accepted into workspace, please load your workspace in eclipse and check whats wrong") self.is_user_aborting(changeEntry) # self.retryacceptincludingnextchangesets(changeEntry, changeentries) - if not Differ.has_diff(): + Commiter.justadd(changeEntry) + if not Differ.has_diff(True): # no differences found - force reload of the workspace shouter.shout("No changes for commiting in git detected, going to reload the workspace") WorkspaceHandler().load() - if not Differ.has_diff(): + Commiter.justadd(changeEntry) + if not Differ.has_diff(True): shouter.shout("Still no changes... Please load your workspace in eclipse and check whats wrong") # still no differences, something wrong self.is_user_aborting(changeEntry) shouter.shout("Accepted change %d/%d into working directory" % (amountofacceptedchanges, amountofchanges)) - Commiter.addandcommit(changeEntry) + Commiter.justcommit(changeEntry) return amountofacceptedchanges @staticmethod