You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed issue where untracked files are not cleaned during update by introducing a --clean-files#215
To ensure that this is not used by accident the full command is `mbed update --clean --clean-files`
Also rename --force switch to --clean-deps for consistency, e..g `mbed update --clean --clean-deps`
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -295,19 +295,21 @@ Run `mbed update <tag_name|revision> --clean`
295
295
296
296
__When you have unpublished local libraries__
297
297
298
-
There are two additional options that define how unpublished local libraries are handled:
298
+
There are 3 additional options that define how unpublished local libraries are handled:
299
299
300
-
`mbed update --ignore` - update the current program or library and its dependencies, and ignore any local unpublished libraries (they won't be deleted or modified, just ignored).
300
+
`mbed update --clean-deps` - update the current program or library and its dependencies, and discard all local unpublished repositories. Use this with caution as your local unpublished repositories cannot be restored unless you have a backup copy.
301
+
302
+
`mbed update --clean-files` - update the current program or library and its dependencies, discard local uncommitted changes and remove any untracked or ignored files. Use this with caution as your local unpublished repositories cannot be restored unless you have a backup copy.
301
303
302
-
`mbed update --force` - update the current program or library and its dependencies, and discard all local unpublished repositories. Use this with caution as your local unpublished repositories cannot be restored unless you have a backup copy.
304
+
`mbed update --ignore` - update the current program or library and its dependencies, and ignore any local unpublished libraries (they won't be deleted or modified, just ignored).
303
305
304
306
__Combining update options__
305
307
306
308
You can combine the options above for the following scenarios:
307
309
308
-
`mbed update --clean --ignore` - update the current program or library and its dependencies, but ignore any local repositories. mbed-cli will update whatever it can from public repositories.
310
+
`mbed update --clean --clean-deps --clean-files` - update the current program or library and its dependencies, remove all local unpublished libraries, discard local uncommitted changes, and remove all untracked or ignored files. This wipes every single change that you made in the source tree and restores the stock layout.
309
311
310
-
`mbed update --clean --force` - update the current program or library and all its dependencies, and restore my source tree to stock layout. This wipes every change that you made in the source tree that didn't belong to the original commit, including uncommitted changes and unpublished local libraries.
312
+
`mbed update --clean --ignore` - update the current program or library and its dependencies, but ignore any local repositories. mbed CLI will update whatever it can from the public repositories.
311
313
312
314
Use these with caution as your uncommitted changes and unpublished libraries cannot be restored.
warning("Unable to cache \"%s\" to \"%s\""% (self.path, cpath))
1051
1055
returnFalse
1052
1056
1053
-
defcan_update(self, clean, force):
1057
+
defcan_update(self, clean, clean_deps):
1054
1058
err=None
1055
-
if (self.is_localorself.urlisNone) andnotforce:
1059
+
if (self.is_localorself.urlisNone) andnotclean_deps:
1056
1060
err= (
1057
1061
"Preserving local library \"%s\" in \"%s\".\nPlease publish this library to a remote URL to be able to restore it at any time."
1058
1062
"You can use --ignore switch to ignore all local libraries and update only the published ones.\n"
1059
-
"You can also use --force switch to remove all local libraries. WARNING: This action cannot be undone."% (self.name, self.path))
1063
+
"You can also use --clean-deps switch to remove all local libraries. WARNING: This action cannot be undone."% (self.name, self.path))
1060
1064
elifnotcleanandself.dirty():
1061
1065
err= (
1062
1066
"Uncommitted changes in \"%s\" in \"%s\".\nPlease discard or stash them first and then retry update.\n"
1063
1067
"You can also use --clean switch to discard all uncommitted changes. WARNING: This action cannot be undone."% (self.name, self.path))
1064
-
elifnotforceandself.outgoing():
1068
+
elifnotclean_depsandself.outgoing():
1065
1069
err= (
1066
1070
"Unpublished changes in \"%s\" in \"%s\".\nPlease publish them first using the \"publish\" command.\n"
1067
-
"You can also use --force to discard all local commits and replace the library with the one included in this revision. WARNING: This action cannot be undone."% (self.name, self.path))
1071
+
"You can also use --clean-deps to discard all local commits and replace the library with the one included in this revision. WARNING: This action cannot be undone."% (self.name, self.path))
dict(name='rev', nargs='?', help='Revision, tag or branch'),
1673
-
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.'),
1674
-
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.'),
1677
+
dict(name=['-C', '--clean'], action='store_true', help='Perform a clean update and discard all modified or untracked files. WARNING: This action cannot be undone. Use with caution.'),
1678
+
dict(name='--clean-files', action='store_true', help='Remove any local ignored files. Requires \'--clean\'. WARNING: This will wipe all local uncommitted, untracked and ignored files. Use with extreme caution.'),
1679
+
dict(name='--clean-deps', action='store_true', help='Remove any local libraries and also libraries containing uncommitted or unpublished changes. Requires \'--clean\'. WARNING: This action cannot be undone. Use with caution.'),
1675
1680
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.'),
1676
1681
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
1677
1682
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
0 commit comments