aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2015-11-07 12:43:59 -0800
committerZac Medico <zmedico@gentoo.org>2015-11-07 13:27:01 -0800
commit9921cfeb51ab8d9dc128aa5e927d29fc675b28b4 (patch)
tree4138de6e324be709f2688c5b811b57723ca6e471
parentRsyncSync: skip metadata-transfer when appropriate (bug 564988) (diff)
downloadportage-9921cfeb51ab8d9dc128aa5e927d29fc675b28b4.tar.gz
portage-9921cfeb51ab8d9dc128aa5e927d29fc675b28b4.tar.bz2
portage-9921cfeb51ab8d9dc128aa5e927d29fc675b28b4.zip
GitSync: skip metadata-transfer when appropriate (bug 564988)
Set updatecache_flg to False if the git revision is unchanged. X-Gentoo-Bug: 564988 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=564988 Acked-by: Brian Dolbec <dolsen@gentoo.org>
-rw-r--r--pym/portage/sync/modules/git/git.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
index c14782c38..179c0dea8 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -2,6 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
import logging
+import subprocess
import portage
from portage import os
@@ -81,6 +82,10 @@ class GitSync(NewBase):
git_cmd = "%s pull%s" % (self.bin_command, git_cmd_opts)
writemsg_level(git_cmd + "\n")
+ rev_cmd = [self.bin_command, "rev-list", "--max-count=1", "HEAD"]
+ previous_rev = subprocess.check_output(rev_cmd,
+ cwd=portage._unicode_encode(self.repo.location))
+
exitcode = portage.process.spawn_bash("cd %s ; exec %s" % (
portage._shell_quote(self.repo.location), git_cmd),
**portage._native_kwargs(self.spawn_kwargs))
@@ -89,4 +94,8 @@ class GitSync(NewBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
return (exitcode, False)
- return (os.EX_OK, True)
+
+ current_rev = subprocess.check_output(rev_cmd,
+ cwd=portage._unicode_encode(self.repo.location))
+
+ return (os.EX_OK, current_rev != previous_rev)