Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/extensions/bin/createNightlies.py

Issue 29358368: Issue 4540 - Add Platform Specific Branch Support to createNightlies.py (Closed)
Left Patch Set: addressing feedback from wladimir Created Oct. 25, 2016, 5:16 p.m.
Right Patch Set: Created Oct. 26, 2016, 5:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .sitescripts.example ('k') | sitescripts/extensions/test/conftest.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 self.changelogFilename = None 76 self.changelogFilename = None
77 77
78 def hasChanges(self): 78 def hasChanges(self):
79 return self.revision != self.previousRevision 79 return self.revision != self.previousRevision
80 80
81 def getCurrentRevision(self): 81 def getCurrentRevision(self):
82 """ 82 """
83 retrieves the current revision ID from the repository 83 retrieves the current revision ID from the repository
84 """ 84 """
85 command = [ 85 command = [
86 'hg', 'id', '-i', '-r', self.config.bookmark, '--config', 86 'hg', 'id', '-i', '-r', self.config.revision, '--config',
87 'defaults.id=', self.config.repository 87 'defaults.id=', self.config.repository
88 ] 88 ]
89 return subprocess.check_output(command).strip() 89 return subprocess.check_output(command).strip()
90 90
91 def getCurrentBuild(self): 91 def getCurrentBuild(self):
92 """ 92 """
93 calculates the (typically numerical) build ID for the current build 93 calculates the (typically numerical) build ID for the current build
94 """ 94 """
95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir] 95 command = ['hg', 'id', '-n', '--config', 'defaults.id=', self.tempdir]
96 build = subprocess.check_output(command).strip() 96 build = subprocess.check_output(command).strip()
97 if self.config.type == 'gecko': 97 if self.config.type == 'gecko':
98 build += '-beta' 98 build += '-beta'
99 return build 99 return build
100 100
101 def getChanges(self): 101 def getChanges(self):
102 """ 102 """
103 retrieve changes between the current and previous ("first") revision 103 retrieve changes between the current and previous ("first") revision
104 """ 104 """
105 105
106 command = [ 106 command = [
107 'hg', 'log', '-R', self.tempdir, '-r', 'ancestors(master)', 107 'hg', 'log', '-R', self.tempdir, '-r',
Wladimir Palant 2016/10/26 15:34:03 You don't want the ancestors of master but rather
Jon Sonesen 2016/10/26 17:44:05 I have locally tested this specific hg call and it
108 '-l', '50', '--encoding', 'utf-8', '--template', 108 'ancestors({})'.format(self.config.revision), '-l', '50',
109 '--encoding', 'utf-8', '--template',
109 '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0', 110 '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0',
110 '--config', 'defaults.log=' 111 '--config', 'defaults.log='
111 ] 112 ]
112 result = subprocess.check_output(command).decode('utf-8') 113 result = subprocess.check_output(command).decode('utf-8')
113 114
114 for change in result.split('\x00\x00'): 115 for change in result.split('\x00\x00'):
115 if change: 116 if change:
116 date, author, revision, description = change.split('\x00') 117 date, author, revision, description = change.split('\x00')
117 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description} 118 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description}
118 119
119 def copyRepository(self): 120 def copyRepository(self):
120 """ 121 """
121 Create a repository copy in a temporary directory 122 Create a repository copy in a temporary directory
122 """ 123 """
123 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 124 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
124 command = ['hg', 'clone', '-q', self.config.repository, '-u', 125 command = ['hg', 'clone', '-q', self.config.repository, '-u',
125 self.config.bookmark, self.tempdir] 126 self.config.revision, self.tempdir]
126 subprocess.check_call(command) 127 subprocess.check_call(command)
127 128
128 # Make sure to run ensure_dependencies.py if present 129 # Make sure to run ensure_dependencies.py if present
129 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') 130 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py')
130 if os.path.isfile(depscript): 131 if os.path.isfile(depscript):
131 subprocess.check_call([sys.executable, depscript, '-q']) 132 subprocess.check_call([sys.executable, depscript, '-q'])
132 133
133 def writeChangelog(self, changes): 134 def writeChangelog(self, changes):
134 """ 135 """
135 write the changelog file into the cloned repository 136 write the changelog file into the cloned repository
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 except Exception as ex: 585 except Exception as ex:
585 logging.error('The build for %s failed:', repo) 586 logging.error('The build for %s failed:', repo)
586 logging.exception(ex) 587 logging.exception(ex)
587 588
588 file = open(nightlyConfigFile, 'wb') 589 file = open(nightlyConfigFile, 'wb')
589 nightlyConfig.write(file) 590 nightlyConfig.write(file)
590 591
591 592
592 if __name__ == '__main__': 593 if __name__ == '__main__':
593 main() 594 main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld