Anonymous avatar Anonymous committed 5bd4745

Teach Mercurial to trust portage user.

Comments (0)

Files changed (1)

smart-live-rebuild.py

 	reqenv = ['EHG_PROJECT', 'EHG_PULL_CMD', 'EHG_REPO_URI']
 	optenv = ['EHG_REVISION']
 
+	trustopt = ['--config', 'trusted.users=portage']
+
 	def __init__(self, cpv, env):
 		VCSSupport.__init__(self, cpv, env)
 		if self.env['EHG_REVISION'] and self.env['EHG_REVISION'] != 'tip':
 			return self.cpv
 
 	def getrev(self):
-		return self.call(['hg', 'tip', '--template', '{node}'])
+		return self.call(['hg', 'tip', '--template', '{node}'] + self.trustopt)
 
 	def getupdatecmd(self):
-		# in fact, we should get that from hgrc or rather hg should get it itself
-		# but it complains about not trusting portage:portage, and we really
-		# don't want to enforce user to 'su' before calling us
-		return '%s %s' % (self.env['EHG_PULL_CMD'], self.env['EHG_REPO_URI'])
+		return ' '.join([self.env['EHG_PULL_CMD']] + self.trustopt)
 
 	def diffstat(self, oldrev, newrev):
-		subprocess.Popen('hg diff --stat -r %s -r %s' % (oldrev, newrev), shell=True).wait()
+		subprocess.Popen(['hg', 'diff', '--stat', '-r', oldrev, '-r', newrev] + self.trustopt).wait()
 
 class SvnSupport(VCSSupport):
 	inherit = 'subversion'
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.