Skip to content

Commit 9a83bb0

Browse files
committed
Add --ignore flag to deploy, import, add to ignore errors related to checking out specific revisions (which may occur if the history of a library was rewritten during rebase)
1 parent e6e1996 commit 9a83bb0

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

mbed/mbed.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Default paths to Mercurial and Git
2020
hg_cmd = 'hg'
2121
git_cmd = 'git'
22-
ver = '0.3.1'
22+
ver = '0.3.2'
2323

2424
ignores = [
2525
# Version control folders
@@ -1305,10 +1305,11 @@ def new(name, scm='git', depth=None, protocol=None):
13051305
@subcommand('import',
13061306
dict(name='url', help='URL of the %s' % cwd_dest),
13071307
dict(name='path', nargs='?', help='Destination name or path. Default: current %s.' % cwd_type),
1308+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to cloning and updating.'),
13081309
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
13091310
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
13101311
help='Import a program and its dependencies into the current directory or specified destination path.')
1311-
def import_(url, path=None, depth=None, protocol=None, top=True):
1312+
def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
13121313
global cwd_root
13131314

13141315
repo = Repo.fromurl(url, path)
@@ -1345,7 +1346,7 @@ def import_(url, path=None, depth=None, protocol=None, top=True):
13451346
cwd_root = repo.path
13461347

13471348
with cd(repo.path):
1348-
deploy(depth=depth, protocol=protocol, top=False)
1349+
deploy(ignore, depth=depth, protocol=protocol, top=False)
13491350

13501351
if top:
13511352
program = Program(repo.path)
@@ -1354,20 +1355,21 @@ def import_(url, path=None, depth=None, protocol=None, top=True):
13541355

13551356
# Deploy command
13561357
@subcommand('deploy',
1358+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to cloning and updating.'),
13571359
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
13581360
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
13591361
help='Import missing dependencies in the current program or library.')
1360-
def deploy(depth=None, protocol=None, top=True):
1362+
def deploy(ignore=False, depth=None, protocol=None, top=True):
13611363
repo = Repo.fromrepo()
13621364
repo.ignores()
13631365

13641366
for lib in repo.libs:
13651367
if os.path.isdir(lib.path):
13661368
if lib.check_repo():
13671369
with cd(lib.path):
1368-
update(lib.rev, depth=depth, protocol=protocol, top=False)
1370+
update(lib.rev, ignore=ignore, depth=depth, protocol=protocol, top=False)
13691371
else:
1370-
import_(lib.fullurl, lib.path, depth=depth, protocol=protocol, top=False)
1372+
import_(lib.fullurl, lib.path, ignore=ignore, depth=depth, protocol=protocol, top=False)
13711373
repo.ignore(relpath(repo.path, lib.path))
13721374

13731375
if top:
@@ -1379,14 +1381,15 @@ def deploy(depth=None, protocol=None, top=True):
13791381
@subcommand('add',
13801382
dict(name='url', help='URL of the library'),
13811383
dict(name='path', nargs='?', help='Destination name or path. Default: current folder.'),
1384+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to cloning and updating.'),
13821385
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
13831386
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
13841387
help='Add a library and its dependencies into the current %s or specified destination path.' % cwd_type)
13851388
def add(url, path=None, depth=None, protocol=None):
13861389
repo = Repo.fromrepo()
13871390

13881391
lib = Repo.fromurl(url, path)
1389-
import_(lib.fullurl, lib.path, depth=depth, protocol=protocol, top=False)
1392+
import_(lib.fullurl, lib.path, ignore=ignore, depth=depth, protocol=protocol, top=False)
13901393
repo.ignore(relpath(repo.path, lib.path))
13911394
lib.sync()
13921395

@@ -1452,7 +1455,7 @@ def publish(all=None, top=True):
14521455
dict(name='rev', nargs='?', help='Revision, tag or branch'),
14531456
dict(name=['-C', '--clean'], action='store_true', help='Perform a clean update and discard all local changes. WARNING: This action cannot be undone. Use with caution.'),
14541457
dict(name=['-F', '--force'], action='store_true', help='Enforce the original layout and will remove any local libraries and also libraries containing uncommitted or unpublished changes. WARNING: This action cannot be undone. Use with caution.'),
1455-
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors regarding unpublished libraries, unpublished or uncommitted changes, and attempt to update from associated remote repository URLs.'),
1458+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to unpublished libraries, unpublished or uncommitted changes, and attempt to update from associated remote repository URLs.'),
14561459
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
14571460
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
14581461
help='Update current %s and its dependencies from associated remote repository URLs.' % cwd_type)
@@ -1524,11 +1527,11 @@ def update(rev=None, clean=False, force=False, ignore=False, top=True, depth=Non
15241527
# Import missing repos and update to revs
15251528
for lib in repo.libs:
15261529
if not os.path.isdir(lib.path):
1527-
import_(lib.fullurl, lib.path, depth=depth, protocol=protocol, top=False)
1530+
import_(lib.fullurl, lib.path, ignore=ignore, depth=depth, protocol=protocol, top=False)
15281531
repo.ignore(relpath(repo.path, lib.path))
15291532
else:
15301533
with cd(lib.path):
1531-
update(lib.rev, clean, force, ignore, top=False)
1534+
update(lib.rev, clean, force, ignore=ignore, top=False)
15321535

15331536
if top:
15341537
program = Program(repo.path)
@@ -1594,7 +1597,7 @@ def sync(recursive=True, keep_refs=False, top=True):
15941597
# List command
15951598
@subcommand('ls',
15961599
dict(name=['-a', '--all'], action='store_true', help='List repository URL and revision pairs'),
1597-
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors regarding missing libraries.'),
1600+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to missing libraries.'),
15981601
help='View the current %s dependency tree.' % cwd_type)
15991602
def list_(all=False, prefix='', p_path=None, ignore=False):
16001603
repo = Repo.fromrepo()
@@ -1614,7 +1617,7 @@ def list_(all=False, prefix='', p_path=None, ignore=False):
16141617

16151618
# Command status for cross-SCM status of repositories
16161619
@subcommand('status',
1617-
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors regarding missing libraries.'),
1620+
dict(name=['-I', '--ignore'], action='store_true', help='Ignore errors related to missing libraries.'),
16181621
help='Show status of the current %s and its dependencies.' % cwd_type)
16191622
def status_(ignore=False):
16201623
repo = Repo.fromrepo()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def read(fname):
1111
setup(
1212
name="mbed-cli",
1313
packages=["mbed"],
14-
version="0.3.1",
14+
version="0.3.2",
1515
url='http://github.com/ARMmbed/mbed-cli',
1616
author='ARM mbed',
1717
author_email='[email protected]',

0 commit comments

Comments
 (0)