Skip to content

Commit

Permalink
bug 1138553, get away from falling back to 'default' as revision
Browse files Browse the repository at this point in the history
For now, this is just the app scheduler.
If we don't have a push, we're using 000000 instead of 'default',
which is also working for empty repos.
We should extend this to get some good changeset for repos
that have content, but not yet a push.
  • Loading branch information
Pike committed Feb 8, 2017
1 parent f5042f1 commit bf34952
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
16 changes: 1 addition & 15 deletions vendor-local/l10ninsp/process.py
Expand Up @@ -45,27 +45,13 @@ def createSteps(self, request):
'/%%(%s_branch)s' % mod),
'haltOnFailure': True})
for mod in revs)
idSteps = tuple(
(SetProperty, {'command':
['hg', 'ident', '-i', '-r', '.'],
'workdir': WithProperties(self.base +
'/%%(%s_branch)s' % mod),
'haltOnFailure': True,
'property': '%s_revision' % mod})
for mod in revs)
l10nSteps = (
(ShellCommand, {'command':
['hg', 'update', '-C', '-r',
WithProperties('%(l10n_revision)s')],
'workdir': WithProperties(self.base +
'/%(l10n_branch)s/%(locale)s'),
'haltOnFailure': True}),
(SetProperty, {'command':
['hg', 'ident', '-i', '-r', '.'],
'workdir': WithProperties(self.base +
'/%(l10n_branch)s/%(locale)s'),
'haltOnFailure': True,
'property': 'l10n_revision'}),
)
inspectSteps = (
(InspectLocale, {
Expand All @@ -78,7 +64,7 @@ def createSteps(self, request):
'tree': tree,
'gather_stats': True,
}),)
return sourceSteps + idSteps + l10nSteps + inspectSteps
return sourceSteps + l10nSteps + inspectSteps


class DirFactory(Factory):
Expand Down
32 changes: 16 additions & 16 deletions vendor-local/l10ninsp/scheduler.py
Expand Up @@ -340,23 +340,23 @@ def submitBuildsets(self):
for k, v in _t.branches.iteritems():
props.setProperty(k+"_branch", v, "Scheduler")
_r = "default"
if k == 'l10n':
repo = '%s/%s' % (v, locale)
else:
repo = v
q = Push.objects.filter(repository__name=repo,
changesets__branch__name='default')
if when is not None:
if k == 'l10n':
repo = '%s/%s' % (v, locale)
else:
repo = v
q = Push.objects.filter(repository__name=repo,
push_date__lte=when,
changesets__branch__name='default')
try:
# get the latest changeset on the 'default' branch
# not strictly .tip, for pushes with heads on
# multiple branches (bug 602182)
_c = q.order_by('-pk')[0].changesets.order_by('-pk')
_r = str(_c.filter(branch__name='default')[0].shortrev)
except IndexError:
# no pushes, update to empty repo 000000000000
_r = "default"
q = q.filter(push_date__lte=when)
try:
# get the latest changeset on the 'default' branch
# not strictly .tip, for pushes with heads on
# multiple branches (bug 602182)
_c = q.order_by('-pk')[0].changesets.order_by('-pk')
_r = str(_c.filter(branch__name='default')[0].revision)
except IndexError:
# no pushes, update to empty repo 000000000000
_r = "000000000000"
props.setProperty(k+"_revision", _r, "Scheduler")
props.update({"tree": tree,
"locale": locale,
Expand Down

0 comments on commit bf34952

Please sign in to comment.