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

Side by Side Diff: sitescripts/extensions/bin/createNightlies.py

Issue 29358368: Issue 4540 - Add Platform Specific Branch Support to createNightlies.py (Closed)
Patch Set: addressing feedback from wladimir Created Oct. 25, 2016, 5:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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', 'default', '--config', 'defaults.id=', 86 'hg', 'id', '-i', '-r', self.config.bookmark, '--config',
87 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 = ['hg', 'log', '-R', self.tempdir, '-r', 'tip:0', 106 command = [
107 '-b', 'default', '-l', '50', '--encoding', 'utf-8', 107 'hg', 'log', '-R', self.tempdir, '-r', 'ancestors(master)',
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 '--template', '{date|isodate}\\0{author|person}\\0{rev}\\0{de sc}\\0\\0', 108 '-l', '50', '--encoding', 'utf-8', '--template',
109 '--config', 'defaults.log='] 109 '{date|isodate}\\0{author|person}\\0{rev}\\0{desc}\\0\\0',
110 '--config', 'defaults.log='
111 ]
110 result = subprocess.check_output(command).decode('utf-8') 112 result = subprocess.check_output(command).decode('utf-8')
111 113
112 for change in result.split('\x00\x00'): 114 for change in result.split('\x00\x00'):
113 if change: 115 if change:
114 date, author, revision, description = change.split('\x00') 116 date, author, revision, description = change.split('\x00')
115 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description} 117 yield {'date': date, 'author': author, 'revision': revision, 'de scription': description}
116 118
117 def copyRepository(self): 119 def copyRepository(self):
118 """ 120 """
119 Create a repository copy in a temporary directory 121 Create a repository copy in a temporary directory
120 """ 122 """
121 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) 123 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName)
122 command = ['hg', 'clone', '-q', self.config.repository, '-u', 'default', self.tempdir] 124 command = ['hg', 'clone', '-q', self.config.repository, '-u',
125 self.config.bookmark, self.tempdir]
123 subprocess.check_call(command) 126 subprocess.check_call(command)
124 127
125 # Make sure to run ensure_dependencies.py if present 128 # Make sure to run ensure_dependencies.py if present
126 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py') 129 depscript = os.path.join(self.tempdir, 'ensure_dependencies.py')
127 if os.path.isfile(depscript): 130 if os.path.isfile(depscript):
128 subprocess.check_call([sys.executable, depscript, '-q']) 131 subprocess.check_call([sys.executable, depscript, '-q'])
129 132
130 def writeChangelog(self, changes): 133 def writeChangelog(self, changes):
131 """ 134 """
132 write the changelog file into the cloned repository 135 write the changelog file into the cloned repository
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 except Exception as ex: 584 except Exception as ex:
582 logging.error('The build for %s failed:', repo) 585 logging.error('The build for %s failed:', repo)
583 logging.exception(ex) 586 logging.exception(ex)
584 587
585 file = open(nightlyConfigFile, 'wb') 588 file = open(nightlyConfigFile, 'wb')
586 nightlyConfig.write(file) 589 nightlyConfig.write(file)
587 590
588 591
589 if __name__ == '__main__': 592 if __name__ == '__main__':
590 main() 593 main()
OLDNEW

Powered by Google App Engine
This is Rietveld