Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --remove-untracked option to the install command. #2172

Merged
merged 13 commits into from
May 1, 2020
Prev Previous commit
Next Next commit
Call the option --remove-untracked instead.
  • Loading branch information
PetterS committed Mar 18, 2020
commit d717e0bcc28796c58fef91c1a730bc707b663f2c
6 changes: 2 additions & 4 deletions poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class InstallCommand(EnvCommand):
"(implicitly enables --verbose).",
),
option(
"keep-untracked",
None,
"Does not remove packages not present in the lock file.",
"remove-untracked", None, "Removes packages not present in the lock file.",
),
option(
"extras",
Expand Down Expand Up @@ -63,7 +61,7 @@ def handle(self):
installer.extras(extras)
installer.dev_mode(not self.option("no-dev"))
installer.dry_run(self.option("dry-run"))
installer.keep_untracked(self.option("keep-untracked"))
installer.remove_untracked(self.option("remove-untracked"))
installer.verbose(self.option("verbose"))

return_code = installer.run()
Expand Down
12 changes: 6 additions & 6 deletions poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
self._pool = pool

self._dry_run = False
self._keep_untracked = False
self._remove_untracked = False
self._update = False
self._verbose = False
self._write_lock = True
Expand Down Expand Up @@ -84,13 +84,13 @@ def dry_run(self, dry_run=True): # type: (bool) -> Installer
def is_dry_run(self): # type: () -> bool
return self._dry_run

def keep_untracked(self, keep_untracked=True): # type: (bool) -> Installer
self._keep_untracked = keep_untracked
def remove_untracked(self, remove_untracked=True): # type: (bool) -> Installer
self._remove_untracked = remove_untracked

return self

def is_keep_untracked(self): # type: () -> bool
return self._keep_untracked
def is_remove_untracked(self): # type: () -> bool
return self._remove_untracked

def verbose(self, verbose=True): # type: (bool) -> Installer
self._verbose = verbose
Expand Down Expand Up @@ -433,7 +433,7 @@ def _get_operations_from_lock(

ops.append(op)

if not self._keep_untracked:
if self._remove_untracked:
for installed in installed_repo.packages:
is_in_lock_file = False
for locked in locked_repository.packages:
Expand Down