# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

def GetFactoryProperties(api, factory_properties, build_properties):
  # TODO(iannucci): Pass the build repo info directly via build_properties
  repo_name = factory_properties.get('repo_name')
  steps = api.Steps(build_properties)

  spec = steps.gclient_common_spec(repo_name)

  git_steps = []
  if spec['solutions'][0]['url'].endswith('.git'):
    email = 'commit-bot@chromium.org'
    git_steps = [
      steps.git_step('config', 'user.email', email),
      steps.git_step('config', 'user.name', 'The Commit Bot'),
      steps.git_step('clean', '-xfq'),
    ]

  return {
    'checkout': 'gclient',
    'gclient_spec': spec,
    'steps': git_steps + [
      steps.apply_issue_step(),
      steps.step('presubmit', [
        api.depot_tools_path('presubmit_support.py'),
        '--root', api.checkout_path(),
        '--commit',
        '--verbose', '--verbose',
        '--author', build_properties['blamelist'][0],
        '--issue', build_properties['issue'],
        '--patchset', build_properties['patchset'],
        '--skip_canned', 'CheckRietveldTryJobExecution',
        '--skip_canned', 'CheckTreeIsOpen',
        '--skip_canned', 'CheckBuildbotPendingBuilds',
        '--skip_canned', 'CheckOwners',
        '--rietveld_url', build_properties['rietveld']])
    ]
  }

@@ -1032,62 +1032,8 @@
 e',%0A
-        '--author', build_properties%5B'blamelist'%5D%5B0%5D,%0A
     
@@ -1376,16 +1376,44 @@
 etveld'%5D
+,%0A        '--rietveld_fetch'
 %5D)%0A    %5D

Fix presubmit recipe to fetch description from rietveld.