Skip to content

Commit f8b2d38

Browse files
committed
do fetch before checking outgoing changes
1 parent b2d6057 commit f8b2d38

File tree

1 file changed

+10
-0
lines changed
  • tools/src/main/python/opengrok_tools/scm

1 file changed

+10
-0
lines changed

tools/src/main/python/opengrok_tools/scm/git.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,18 @@ def get_branch(self):
6464

6565
return branch
6666

67+
def fetch(self):
68+
status, out = self._run_command([self.command, 'fetch'])
69+
if status != 0:
70+
raise RepositoryException("cannot fetch {}: {}".format(self, out))
71+
6772
def strip_outgoing(self):
73+
"""
74+
Check for outgoing changes and if found, strip them.
75+
:return: True if there were any changes stripped, False otherwise.
76+
"""
6877
self._configure_git_pull()
78+
self.fetch()
6979
branch = self.get_branch()
7080
status, out = self._run_command([self.command, 'log',
7181
'--pretty=tformat:%H', '--reverse', 'origin/' + branch + '..'])

0 commit comments

Comments
 (0)