Skip to content

Commit

Permalink
diff against HEAD to fix rtcTo#153
Browse files Browse the repository at this point in the history
  • Loading branch information
Balz Guenat committed May 13, 2019
1 parent dc0736c commit 8934ccc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
25 changes: 23 additions & 2 deletions gitFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions rtcFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8934ccc

Please sign in to comment.