Commits

Anonymous committed 2b38b96

Support calling 'diff --stat' like git.eclass does.

Comments (0)

Files changed (1)

smart-live-rebuild.py

 		ret = subprocess.Popen(cmd, shell=True).wait()
 		return (ret == 0)
 
+	def diffstat(self, oldrev, newrev):
+		pass
+
 	def update(self):
 		out.s2(unicode(self))
 		os.chdir(self.getpath())
 				out.s3('at rev %s%s%s (no changes)' % (out.green, oldrev, out.reset))
 				return False
 			else:
+				self.diffstat(oldrev, newrev)
 				out.s3('update from %s%s%s to %s%s%s' % (out.green, oldrev, out.reset, out.lime, newrev, out.reset))
 				return True
 
 class GitSupport(VCSSupport):
 	inherit = 'git'
 	reqenv = ['EGIT_BRANCH', 'EGIT_PROJECT', 'EGIT_STORE_DIR', 'EGIT_UPDATE_CMD']
-	optenv = ['EGIT_HAS_SUBMODULES', 'EGIT_OPTIONS', 'EGIT_REPO_URI']
+	optenv = ['EGIT_DIFFSTAT_CMD', 'EGIT_HAS_SUBMODULES', 'EGIT_OPTIONS', 'EGIT_REPO_URI']
 
 	def __init__(self, cpv, env):
 		VCSSupport.__init__(self, cpv, env)
 	def getupdatecmd(self):
 		return '%s %s origin %s:%s' % (self.env['EGIT_UPDATE_CMD'], self.env['EGIT_OPTIONS'], self.env['EGIT_BRANCH'], self.env['EGIT_BRANCH'])
 
+	def diffstat(self, oldrev, newrev):
+		subprocess.Popen('%s %s..%s' % (self.env['EGIT_DIFFSTAT_CMD'] or 'git diff', oldrev, newrev), shell=True).wait()
+
 class HgSupport(VCSSupport):
 	inherit = 'mercurial'
 	reqenv = ['EHG_PROJECT', 'EHG_PULL_CMD', 'EHG_REPO_URI']
 		# don't want to enforce user to 'su' before calling us
 		return '%s %s' % (self.env['EHG_PULL_CMD'], self.env['EHG_REPO_URI'])
 
+	def diffstat(self, oldrev, newrev):
+		subprocess.Popen('hg diff --stat -r %s -r %s' % (oldrev, newrev), shell=True).wait()
+
 class SvnSupport(VCSSupport):
 	inherit = 'subversion'
 	reqenv = ['ESVN_STORE_DIR', 'ESVN_UPDATE_CMD', 'ESVN_WC_PATH']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.