Maxim mbed development library

Dependents:   sensomed

Committer:
switches
Date:
Tue Nov 08 18:27:11 2016 +0000
Revision:
0:0e018d759a2a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:0e018d759a2a 1 """
switches 0:0e018d759a2a 2 mbed SDK
switches 0:0e018d759a2a 3 Copyright (c) 2011-2013 ARM Limited
switches 0:0e018d759a2a 4
switches 0:0e018d759a2a 5 Licensed under the Apache License, Version 2.0 (the "License");
switches 0:0e018d759a2a 6 you may not use this file except in compliance with the License.
switches 0:0e018d759a2a 7 You may obtain a copy of the License at
switches 0:0e018d759a2a 8
switches 0:0e018d759a2a 9 http://www.apache.org/licenses/LICENSE-2.0
switches 0:0e018d759a2a 10
switches 0:0e018d759a2a 11 Unless required by applicable law or agreed to in writing, software
switches 0:0e018d759a2a 12 distributed under the License is distributed on an "AS IS" BASIS,
switches 0:0e018d759a2a 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:0e018d759a2a 14 See the License for the specific language governing permissions and
switches 0:0e018d759a2a 15 limitations under the License.
switches 0:0e018d759a2a 16
switches 0:0e018d759a2a 17
switches 0:0e018d759a2a 18 One repository to update them all
switches 0:0e018d759a2a 19 On mbed.org the mbed SDK is split up in multiple repositories, this script takes
switches 0:0e018d759a2a 20 care of updating them all.
switches 0:0e018d759a2a 21 """
switches 0:0e018d759a2a 22 import sys
switches 0:0e018d759a2a 23 from copy import copy
switches 0:0e018d759a2a 24 from os import walk, remove, makedirs
switches 0:0e018d759a2a 25 from os.path import join, abspath, dirname, relpath, exists, isfile
switches 0:0e018d759a2a 26 from shutil import copyfile
switches 0:0e018d759a2a 27 from optparse import OptionParser
switches 0:0e018d759a2a 28 import re
switches 0:0e018d759a2a 29 import string
switches 0:0e018d759a2a 30
switches 0:0e018d759a2a 31 ROOT = abspath(join(dirname(__file__), ".."))
switches 0:0e018d759a2a 32 sys.path.insert(0, ROOT)
switches 0:0e018d759a2a 33
switches 0:0e018d759a2a 34 from tools.settings import MBED_ORG_PATH, MBED_ORG_USER, BUILD_DIR
switches 0:0e018d759a2a 35 from tools.paths import *
switches 0:0e018d759a2a 36 from tools.utils import run_cmd
switches 0:0e018d759a2a 37
switches 0:0e018d759a2a 38 MBED_URL = "mbed.org"
switches 0:0e018d759a2a 39 MBED_USER = "mbed_official"
switches 0:0e018d759a2a 40
switches 0:0e018d759a2a 41 changed = []
switches 0:0e018d759a2a 42 push_remote = True
switches 0:0e018d759a2a 43 quiet = False
switches 0:0e018d759a2a 44 commit_msg = ''
switches 0:0e018d759a2a 45
switches 0:0e018d759a2a 46 # Code that does have a mirror in the mbed SDK
switches 0:0e018d759a2a 47 # Tuple data: (repo_name, list_of_code_dirs, [team])
switches 0:0e018d759a2a 48 # team is optional - if not specified, the code is published under mbed_official
switches 0:0e018d759a2a 49 OFFICIAL_CODE = (
switches 0:0e018d759a2a 50 ("mbed-dev" , [MBED_DRIVERS, MBED_PLATFORM, MBED_HAL]),
switches 0:0e018d759a2a 51 ("mbed-rtos", RTOS),
switches 0:0e018d759a2a 52 ("mbed-dsp" , DSP),
switches 0:0e018d759a2a 53 ("mbed-rpc" , MBED_RPC),
switches 0:0e018d759a2a 54
switches 0:0e018d759a2a 55 ("lwip" , LWIP_SOURCES+"/lwip"),
switches 0:0e018d759a2a 56 ("lwip-sys", LWIP_SOURCES+"/lwip-sys"),
switches 0:0e018d759a2a 57 ("Socket" , LWIP_SOURCES+"/Socket"),
switches 0:0e018d759a2a 58
switches 0:0e018d759a2a 59 ("lwip-eth" , ETH_SOURCES+"/lwip-eth"),
switches 0:0e018d759a2a 60 ("EthernetInterface", ETH_SOURCES+"/EthernetInterface"),
switches 0:0e018d759a2a 61
switches 0:0e018d759a2a 62 ("USBDevice", USB),
switches 0:0e018d759a2a 63 ("USBHost" , USB_HOST),
switches 0:0e018d759a2a 64
switches 0:0e018d759a2a 65 ("CellularModem", CELLULAR_SOURCES),
switches 0:0e018d759a2a 66 ("CellularUSBModem", CELLULAR_USB_SOURCES),
switches 0:0e018d759a2a 67 ("UbloxUSBModem", UBLOX_SOURCES),
switches 0:0e018d759a2a 68 ("UbloxModemHTTPClientTest", [TEST_DIR+"/net/cellular/http/common", TEST_DIR+"/net/cellular/http/ubloxusb"]),
switches 0:0e018d759a2a 69 ("UbloxModemSMSTest", [TEST_DIR+"/net/cellular/sms/common", TEST_DIR+"/net/cellular/sms/ubloxusb"]),
switches 0:0e018d759a2a 70 ("FATFileSystem", FAT_FS, "mbed-official"),
switches 0:0e018d759a2a 71 )
switches 0:0e018d759a2a 72
switches 0:0e018d759a2a 73
switches 0:0e018d759a2a 74 # Code that does have dependencies to libraries should point to
switches 0:0e018d759a2a 75 # the latest revision. By default, they point to a specific revision.
switches 0:0e018d759a2a 76 CODE_WITH_DEPENDENCIES = (
switches 0:0e018d759a2a 77 # Libraries
switches 0:0e018d759a2a 78 "EthernetInterface",
switches 0:0e018d759a2a 79
switches 0:0e018d759a2a 80 # RTOS Examples
switches 0:0e018d759a2a 81 "rtos_basic",
switches 0:0e018d759a2a 82 "rtos_isr",
switches 0:0e018d759a2a 83 "rtos_mail",
switches 0:0e018d759a2a 84 "rtos_mutex",
switches 0:0e018d759a2a 85 "rtos_queue",
switches 0:0e018d759a2a 86 "rtos_semaphore",
switches 0:0e018d759a2a 87 "rtos_signals",
switches 0:0e018d759a2a 88 "rtos_timer",
switches 0:0e018d759a2a 89
switches 0:0e018d759a2a 90 # Net Examples
switches 0:0e018d759a2a 91 "TCPEchoClient",
switches 0:0e018d759a2a 92 "TCPEchoServer",
switches 0:0e018d759a2a 93 "TCPSocket_HelloWorld",
switches 0:0e018d759a2a 94 "UDPSocket_HelloWorld",
switches 0:0e018d759a2a 95 "UDPEchoClient",
switches 0:0e018d759a2a 96 "UDPEchoServer",
switches 0:0e018d759a2a 97 "BroadcastReceive",
switches 0:0e018d759a2a 98 "BroadcastSend",
switches 0:0e018d759a2a 99
switches 0:0e018d759a2a 100 # mbed sources
switches 0:0e018d759a2a 101 "mbed-src-program",
switches 0:0e018d759a2a 102 )
switches 0:0e018d759a2a 103
switches 0:0e018d759a2a 104 # A list of regular expressions that will be checked against each directory
switches 0:0e018d759a2a 105 # name and skipped if they match.
switches 0:0e018d759a2a 106 IGNORE_DIRS = (
switches 0:0e018d759a2a 107 )
switches 0:0e018d759a2a 108
switches 0:0e018d759a2a 109 IGNORE_FILES = (
switches 0:0e018d759a2a 110 'COPYING',
switches 0:0e018d759a2a 111 '\.md',
switches 0:0e018d759a2a 112 "\.lib",
switches 0:0e018d759a2a 113 "\.bld"
switches 0:0e018d759a2a 114 )
switches 0:0e018d759a2a 115
switches 0:0e018d759a2a 116 def ignore_path(name, reg_exps):
switches 0:0e018d759a2a 117 for r in reg_exps:
switches 0:0e018d759a2a 118 if re.search(r, name):
switches 0:0e018d759a2a 119 return True
switches 0:0e018d759a2a 120 return False
switches 0:0e018d759a2a 121
switches 0:0e018d759a2a 122 class MbedRepository:
switches 0:0e018d759a2a 123 @staticmethod
switches 0:0e018d759a2a 124 def run_and_print(command, cwd):
switches 0:0e018d759a2a 125 stdout, _, _ = run_cmd(command, work_dir=cwd, redirect=True)
switches 0:0e018d759a2a 126 print(stdout)
switches 0:0e018d759a2a 127
switches 0:0e018d759a2a 128 def __init__(self, name, team = None):
switches 0:0e018d759a2a 129 self.name = name
switches 0:0e018d759a2a 130 self.path = join(MBED_ORG_PATH, name)
switches 0:0e018d759a2a 131 if team is None:
switches 0:0e018d759a2a 132 self.url = "http://" + MBED_URL + "/users/" + MBED_USER + "/code/%s/"
switches 0:0e018d759a2a 133 else:
switches 0:0e018d759a2a 134 self.url = "http://" + MBED_URL + "/teams/" + team + "/code/%s/"
switches 0:0e018d759a2a 135 if not exists(self.path):
switches 0:0e018d759a2a 136 # Checkout code
switches 0:0e018d759a2a 137 if not exists(MBED_ORG_PATH):
switches 0:0e018d759a2a 138 makedirs(MBED_ORG_PATH)
switches 0:0e018d759a2a 139
switches 0:0e018d759a2a 140 self.run_and_print(['hg', 'clone', self.url % name], cwd=MBED_ORG_PATH)
switches 0:0e018d759a2a 141
switches 0:0e018d759a2a 142 else:
switches 0:0e018d759a2a 143 # Update
switches 0:0e018d759a2a 144 self.run_and_print(['hg', 'pull'], cwd=self.path)
switches 0:0e018d759a2a 145 self.run_and_print(['hg', 'update'], cwd=self.path)
switches 0:0e018d759a2a 146
switches 0:0e018d759a2a 147 def publish(self):
switches 0:0e018d759a2a 148 # The maintainer has to evaluate the changes first and explicitly accept them
switches 0:0e018d759a2a 149 self.run_and_print(['hg', 'addremove'], cwd=self.path)
switches 0:0e018d759a2a 150 stdout, _, _ = run_cmd(['hg', 'status'], work_dir=self.path)
switches 0:0e018d759a2a 151 if stdout == '':
switches 0:0e018d759a2a 152 print "No changes"
switches 0:0e018d759a2a 153 return False
switches 0:0e018d759a2a 154 print stdout
switches 0:0e018d759a2a 155 if quiet:
switches 0:0e018d759a2a 156 commit = 'Y'
switches 0:0e018d759a2a 157 else:
switches 0:0e018d759a2a 158 commit = raw_input(push_remote and "Do you want to commit and push? Y/N: " or "Do you want to commit? Y/N: ")
switches 0:0e018d759a2a 159 if commit == 'Y':
switches 0:0e018d759a2a 160 args = ['hg', 'commit', '-u', MBED_ORG_USER]
switches 0:0e018d759a2a 161 if commit_msg:
switches 0:0e018d759a2a 162 args = args + ['-m', commit_msg]
switches 0:0e018d759a2a 163 self.run_and_print(args, cwd=self.path)
switches 0:0e018d759a2a 164 if push_remote:
switches 0:0e018d759a2a 165 self.run_and_print(['hg', 'push'], cwd=self.path)
switches 0:0e018d759a2a 166 return True
switches 0:0e018d759a2a 167
switches 0:0e018d759a2a 168 # Check if a file is a text file or a binary file
switches 0:0e018d759a2a 169 # Taken from http://code.activestate.com/recipes/173220/
switches 0:0e018d759a2a 170 text_characters = "".join(map(chr, range(32, 127)) + list("\n\r\t\b"))
switches 0:0e018d759a2a 171 _null_trans = string.maketrans("", "")
switches 0:0e018d759a2a 172 def is_text_file(filename):
switches 0:0e018d759a2a 173 block_size = 1024
switches 0:0e018d759a2a 174 def istext(s):
switches 0:0e018d759a2a 175 if "\0" in s:
switches 0:0e018d759a2a 176 return 0
switches 0:0e018d759a2a 177
switches 0:0e018d759a2a 178 if not s: # Empty files are considered text
switches 0:0e018d759a2a 179 return 1
switches 0:0e018d759a2a 180
switches 0:0e018d759a2a 181 # Get the non-text characters (maps a character to itself then
switches 0:0e018d759a2a 182 # use the 'remove' option to get rid of the text characters.)
switches 0:0e018d759a2a 183 t = s.translate(_null_trans, text_characters)
switches 0:0e018d759a2a 184
switches 0:0e018d759a2a 185 # If more than 30% non-text characters, then
switches 0:0e018d759a2a 186 # this is considered a binary file
switches 0:0e018d759a2a 187 if float(len(t))/len(s) > 0.30:
switches 0:0e018d759a2a 188 return 0
switches 0:0e018d759a2a 189 return 1
switches 0:0e018d759a2a 190 with open(filename) as f:
switches 0:0e018d759a2a 191 res = istext(f.read(block_size))
switches 0:0e018d759a2a 192 return res
switches 0:0e018d759a2a 193
switches 0:0e018d759a2a 194 # Return the line ending type for the given file ('cr' or 'crlf')
switches 0:0e018d759a2a 195 def get_line_endings(f):
switches 0:0e018d759a2a 196 examine_size = 1024
switches 0:0e018d759a2a 197 try:
switches 0:0e018d759a2a 198 tf = open(f, "rb")
switches 0:0e018d759a2a 199 lines, ncrlf = tf.readlines(examine_size), 0
switches 0:0e018d759a2a 200 tf.close()
switches 0:0e018d759a2a 201 for l in lines:
switches 0:0e018d759a2a 202 if l.endswith("\r\n"):
switches 0:0e018d759a2a 203 ncrlf = ncrlf + 1
switches 0:0e018d759a2a 204 return 'crlf' if ncrlf > len(lines) >> 1 else 'cr'
switches 0:0e018d759a2a 205 except:
switches 0:0e018d759a2a 206 return 'cr'
switches 0:0e018d759a2a 207
switches 0:0e018d759a2a 208 # Copy file to destination, but preserve destination line endings if possible
switches 0:0e018d759a2a 209 # This prevents very annoying issues with huge diffs that appear because of
switches 0:0e018d759a2a 210 # differences in line endings
switches 0:0e018d759a2a 211 def copy_with_line_endings(sdk_file, repo_file):
switches 0:0e018d759a2a 212 if not isfile(repo_file):
switches 0:0e018d759a2a 213 copyfile(sdk_file, repo_file)
switches 0:0e018d759a2a 214 return
switches 0:0e018d759a2a 215 is_text = is_text_file(repo_file)
switches 0:0e018d759a2a 216 if is_text:
switches 0:0e018d759a2a 217 sdk_le = get_line_endings(sdk_file)
switches 0:0e018d759a2a 218 repo_le = get_line_endings(repo_file)
switches 0:0e018d759a2a 219 if not is_text or sdk_le == repo_le:
switches 0:0e018d759a2a 220 copyfile(sdk_file, repo_file)
switches 0:0e018d759a2a 221 else:
switches 0:0e018d759a2a 222 print "Converting line endings in '%s' to '%s'" % (abspath(repo_file), repo_le)
switches 0:0e018d759a2a 223 f = open(sdk_file, "rb")
switches 0:0e018d759a2a 224 data = f.read()
switches 0:0e018d759a2a 225 f.close()
switches 0:0e018d759a2a 226 f = open(repo_file, "wb")
switches 0:0e018d759a2a 227 data = data.replace("\r\n", "\n") if repo_le == 'cr' else data.replace('\n','\r\n')
switches 0:0e018d759a2a 228 f.write(data)
switches 0:0e018d759a2a 229 f.close()
switches 0:0e018d759a2a 230
switches 0:0e018d759a2a 231 def visit_files(path, visit):
switches 0:0e018d759a2a 232 for root, dirs, files in walk(path):
switches 0:0e018d759a2a 233 # Ignore hidden directories
switches 0:0e018d759a2a 234 for d in copy(dirs):
switches 0:0e018d759a2a 235 full = join(root, d)
switches 0:0e018d759a2a 236 if d.startswith('.'):
switches 0:0e018d759a2a 237 dirs.remove(d)
switches 0:0e018d759a2a 238 if ignore_path(full, IGNORE_DIRS):
switches 0:0e018d759a2a 239 print "Skipping '%s'" % full
switches 0:0e018d759a2a 240 dirs.remove(d)
switches 0:0e018d759a2a 241
switches 0:0e018d759a2a 242 for file in files:
switches 0:0e018d759a2a 243 if ignore_path(file, IGNORE_FILES):
switches 0:0e018d759a2a 244 continue
switches 0:0e018d759a2a 245
switches 0:0e018d759a2a 246 visit(join(root, file))
switches 0:0e018d759a2a 247
switches 0:0e018d759a2a 248
switches 0:0e018d759a2a 249 def update_repo(repo_name, sdk_paths, team_name):
switches 0:0e018d759a2a 250 repo = MbedRepository(repo_name, team_name)
switches 0:0e018d759a2a 251 # copy files from mbed SDK to mbed_official repository
switches 0:0e018d759a2a 252 def visit_mbed_sdk(sdk_file):
switches 0:0e018d759a2a 253 repo_file = join(repo.path, relpath(sdk_file, sdk_path))
switches 0:0e018d759a2a 254
switches 0:0e018d759a2a 255 repo_dir = dirname(repo_file)
switches 0:0e018d759a2a 256 if not exists(repo_dir):
switches 0:0e018d759a2a 257 makedirs(repo_dir)
switches 0:0e018d759a2a 258
switches 0:0e018d759a2a 259 copy_with_line_endings(sdk_file, repo_file)
switches 0:0e018d759a2a 260 for sdk_path in sdk_paths:
switches 0:0e018d759a2a 261 visit_files(sdk_path, visit_mbed_sdk)
switches 0:0e018d759a2a 262
switches 0:0e018d759a2a 263 # remove repository files that do not exist in the mbed SDK
switches 0:0e018d759a2a 264 def visit_repo(repo_file):
switches 0:0e018d759a2a 265 for sdk_path in sdk_paths:
switches 0:0e018d759a2a 266 sdk_file = join(sdk_path, relpath(repo_file, repo.path))
switches 0:0e018d759a2a 267 if exists(sdk_file):
switches 0:0e018d759a2a 268 break
switches 0:0e018d759a2a 269 else:
switches 0:0e018d759a2a 270 remove(repo_file)
switches 0:0e018d759a2a 271 print "remove: %s" % repo_file
switches 0:0e018d759a2a 272 visit_files(repo.path, visit_repo)
switches 0:0e018d759a2a 273
switches 0:0e018d759a2a 274 if repo.publish():
switches 0:0e018d759a2a 275 changed.append(repo_name)
switches 0:0e018d759a2a 276
switches 0:0e018d759a2a 277
switches 0:0e018d759a2a 278 def update_code(repositories):
switches 0:0e018d759a2a 279 for r in repositories:
switches 0:0e018d759a2a 280 repo_name, sdk_dir = r[0], r[1]
switches 0:0e018d759a2a 281 team_name = r[2] if len(r) == 3 else None
switches 0:0e018d759a2a 282 print '\n=== Updating "%s" ===' % repo_name
switches 0:0e018d759a2a 283 sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
switches 0:0e018d759a2a 284 update_repo(repo_name, sdk_dirs, team_name)
switches 0:0e018d759a2a 285
switches 0:0e018d759a2a 286 def update_single_repo(repo):
switches 0:0e018d759a2a 287 repos = [r for r in OFFICIAL_CODE if r[0] == repo]
switches 0:0e018d759a2a 288 if not repos:
switches 0:0e018d759a2a 289 print "Repository '%s' not found" % repo
switches 0:0e018d759a2a 290 else:
switches 0:0e018d759a2a 291 update_code(repos)
switches 0:0e018d759a2a 292
switches 0:0e018d759a2a 293 def update_dependencies(repositories):
switches 0:0e018d759a2a 294 for repo_name in repositories:
switches 0:0e018d759a2a 295 print '\n=== Updating "%s" ===' % repo_name
switches 0:0e018d759a2a 296 repo = MbedRepository(repo_name)
switches 0:0e018d759a2a 297
switches 0:0e018d759a2a 298 # point to the latest libraries
switches 0:0e018d759a2a 299 def visit_repo(repo_file):
switches 0:0e018d759a2a 300 with open(repo_file, "r") as f:
switches 0:0e018d759a2a 301 url = f.read()
switches 0:0e018d759a2a 302 with open(repo_file, "w") as f:
switches 0:0e018d759a2a 303 f.write(url[:(url.rindex('/')+1)])
switches 0:0e018d759a2a 304 visit_files(repo.path, visit_repo, None, MBED_REPO_EXT)
switches 0:0e018d759a2a 305
switches 0:0e018d759a2a 306 if repo.publish():
switches 0:0e018d759a2a 307 changed.append(repo_name)
switches 0:0e018d759a2a 308
switches 0:0e018d759a2a 309
switches 0:0e018d759a2a 310 def update_mbed():
switches 0:0e018d759a2a 311 update_repo("mbed", [join(BUILD_DIR, "mbed")], None)
switches 0:0e018d759a2a 312
switches 0:0e018d759a2a 313 def do_sync(options):
switches 0:0e018d759a2a 314 global push_remote, quiet, commit_msg, changed
switches 0:0e018d759a2a 315
switches 0:0e018d759a2a 316 push_remote = not options.nopush
switches 0:0e018d759a2a 317 quiet = options.quiet
switches 0:0e018d759a2a 318 commit_msg = options.msg
switches 0:0e018d759a2a 319 chnaged = []
switches 0:0e018d759a2a 320
switches 0:0e018d759a2a 321 if options.code:
switches 0:0e018d759a2a 322 update_code(OFFICIAL_CODE)
switches 0:0e018d759a2a 323
switches 0:0e018d759a2a 324 if options.dependencies:
switches 0:0e018d759a2a 325 update_dependencies(CODE_WITH_DEPENDENCIES)
switches 0:0e018d759a2a 326
switches 0:0e018d759a2a 327 if options.mbed:
switches 0:0e018d759a2a 328 update_mbed()
switches 0:0e018d759a2a 329
switches 0:0e018d759a2a 330 if options.repo:
switches 0:0e018d759a2a 331 update_single_repo(options.repo)
switches 0:0e018d759a2a 332
switches 0:0e018d759a2a 333 if changed:
switches 0:0e018d759a2a 334 print "Repositories with changes:", changed
switches 0:0e018d759a2a 335
switches 0:0e018d759a2a 336 return changed
switches 0:0e018d759a2a 337
switches 0:0e018d759a2a 338 if __name__ == '__main__':
switches 0:0e018d759a2a 339 parser = OptionParser()
switches 0:0e018d759a2a 340
switches 0:0e018d759a2a 341 parser.add_option("-c", "--code",
switches 0:0e018d759a2a 342 action="store_true", default=False,
switches 0:0e018d759a2a 343 help="Update the mbed_official code")
switches 0:0e018d759a2a 344
switches 0:0e018d759a2a 345 parser.add_option("-d", "--dependencies",
switches 0:0e018d759a2a 346 action="store_true", default=False,
switches 0:0e018d759a2a 347 help="Update the mbed_official code dependencies")
switches 0:0e018d759a2a 348
switches 0:0e018d759a2a 349 parser.add_option("-m", "--mbed",
switches 0:0e018d759a2a 350 action="store_true", default=False,
switches 0:0e018d759a2a 351 help="Release a build of the mbed library")
switches 0:0e018d759a2a 352
switches 0:0e018d759a2a 353 parser.add_option("-n", "--nopush",
switches 0:0e018d759a2a 354 action="store_true", default=False,
switches 0:0e018d759a2a 355 help="Commit the changes locally only, don't push them")
switches 0:0e018d759a2a 356
switches 0:0e018d759a2a 357 parser.add_option("", "--commit_message",
switches 0:0e018d759a2a 358 action="store", type="string", default='', dest='msg',
switches 0:0e018d759a2a 359 help="Commit message to use for all the commits")
switches 0:0e018d759a2a 360
switches 0:0e018d759a2a 361 parser.add_option("-r", "--repository",
switches 0:0e018d759a2a 362 action="store", type="string", default='', dest='repo',
switches 0:0e018d759a2a 363 help="Synchronize only the given repository")
switches 0:0e018d759a2a 364
switches 0:0e018d759a2a 365 parser.add_option("-q", "--quiet",
switches 0:0e018d759a2a 366 action="store_true", default=False,
switches 0:0e018d759a2a 367 help="Don't ask for confirmation before commiting or pushing")
switches 0:0e018d759a2a 368
switches 0:0e018d759a2a 369 (options, args) = parser.parse_args()
switches 0:0e018d759a2a 370
switches 0:0e018d759a2a 371 do_sync(options)
switches 0:0e018d759a2a 372