Skip to content

Commit 63c7d9d

Browse files
committed
remove --clear-index
1 parent f6a684a commit 63c7d9d

File tree

13 files changed

+13
-119
lines changed

13 files changed

+13
-119
lines changed

dvc/command/data_sync.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def run(self):
3030
with_deps=self.args.with_deps,
3131
force=self.args.force,
3232
recursive=self.args.recursive,
33-
clear_index=self.args.clear_index,
3433
)
3534
log_summary(stats)
3635
except (CheckoutError, DvcException) as exc:
@@ -54,7 +53,6 @@ def run(self):
5453
all_commits=self.args.all_commits,
5554
with_deps=self.args.with_deps,
5655
recursive=self.args.recursive,
57-
clear_index=self.args.clear_index,
5856
)
5957
except DvcException:
6058
logger.exception("failed to push data to the cloud")
@@ -164,12 +162,6 @@ def add_parser(subparsers, _parent_parser):
164162
default=False,
165163
help="Pull cache for subdirectories of the specified directory.",
166164
)
167-
pull_parser.add_argument(
168-
"--clear-index",
169-
action="store_true",
170-
default=False,
171-
help="Clear local index for the specified remote.",
172-
)
173165
pull_parser.set_defaults(func=CmdDataPull)
174166

175167
# Push
@@ -219,12 +211,6 @@ def add_parser(subparsers, _parent_parser):
219211
default=False,
220212
help="Push cache for subdirectories of specified directory.",
221213
)
222-
push_parser.add_argument(
223-
"--clear-index",
224-
action="store_true",
225-
default=False,
226-
help="Clear local index for the remote.",
227-
)
228214
push_parser.set_defaults(func=CmdDataPush)
229215

230216
# Fetch
@@ -348,10 +334,4 @@ def add_parser(subparsers, _parent_parser):
348334
default=False,
349335
help="Show status for all dependencies of the specified target.",
350336
)
351-
status_parser.add_argument(
352-
"--clear-index",
353-
action="store_true",
354-
default=False,
355-
help="Clear local index for the remote.",
356-
)
357337
status_parser.set_defaults(func=CmdDataStatus)

dvc/command/status.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def run(self):
4949
all_tags=self.args.all_tags,
5050
all_commits=self.args.all_commits,
5151
with_deps=self.args.with_deps,
52-
clear_index=self.args.clear_index,
5352
)
5453
if st:
5554
if self.args.quiet:

dvc/data_cloud.py

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,7 @@ def get_remote(self, remote=None, command="<command>"):
4848
def _init_remote(self, remote):
4949
return Remote(self.repo, name=remote)
5050

51-
def push(
52-
self,
53-
cache,
54-
jobs=None,
55-
remote=None,
56-
show_checksums=False,
57-
clear_index=False,
58-
):
51+
def push(self, cache, jobs=None, remote=None, show_checksums=False):
5952
"""Push data items in a cloud-agnostic way.
6053
6154
Args:
@@ -65,24 +58,15 @@ def push(
6558
By default remote from core.remote config option is used.
6659
show_checksums (bool): show checksums instead of file names in
6760
information messages.
68-
clear_index (bool): clear local index for the remote
6961
"""
7062
return self.repo.cache.local.push(
7163
cache,
7264
jobs=jobs,
7365
remote=self.get_remote(remote, "push"),
7466
show_checksums=show_checksums,
75-
clear_index=clear_index,
7667
)
7768

78-
def pull(
79-
self,
80-
cache,
81-
jobs=None,
82-
remote=None,
83-
show_checksums=False,
84-
clear_index=False,
85-
):
69+
def pull(self, cache, jobs=None, remote=None, show_checksums=False):
8670
"""Pull data items in a cloud-agnostic way.
8771
8872
Args:
@@ -92,15 +76,10 @@ def pull(
9276
By default remote from core.remote config option is used.
9377
show_checksums (bool): show checksums instead of file names in
9478
information messages.
95-
clear_index (bool): clear local index for the remote
9679
"""
9780
remote = self.get_remote(remote, "pull")
9881
downloaded_items_num = self.repo.cache.local.pull(
99-
cache,
100-
jobs=jobs,
101-
remote=remote,
102-
show_checksums=show_checksums,
103-
clear_index=clear_index,
82+
cache, jobs=jobs, remote=remote, show_checksums=show_checksums
10483
)
10584

10685
if not remote.verify:
@@ -118,14 +97,7 @@ def _save_pulled_checksums(self, cache):
11897
# (see `RemoteBASE.download()`)
11998
self.repo.state.save(cache_file, checksum)
12099

121-
def status(
122-
self,
123-
cache,
124-
jobs=None,
125-
remote=None,
126-
show_checksums=False,
127-
clear_index=False,
128-
):
100+
def status(self, cache, jobs=None, remote=None, show_checksums=False):
129101
"""Check status of data items in a cloud-agnostic way.
130102
131103
Args:
@@ -136,13 +108,8 @@ def status(
136108
is used.
137109
show_checksums (bool): show checksums instead of file names in
138110
information messages.
139-
clear_index (bool): clear local index for the remote
140111
"""
141112
remote = self.get_remote(remote, "status")
142113
return self.repo.cache.local.status(
143-
cache,
144-
jobs=jobs,
145-
remote=remote,
146-
show_checksums=show_checksums,
147-
clear_index=clear_index,
114+
cache, jobs=jobs, remote=remote, show_checksums=show_checksums
148115
)

dvc/remote/local.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ def status(
265265
jobs=None,
266266
show_checksums=False,
267267
download=False,
268-
clear_index=False,
269268
):
270269
# Return flattened dict containing all status info
271270
dir_status, file_status, _ = self._status(
@@ -274,7 +273,6 @@ def status(
274273
jobs=jobs,
275274
show_checksums=show_checksums,
276275
download=download,
277-
clear_index=clear_index,
278276
)
279277
return dict(dir_status, **file_status)
280278

@@ -285,7 +283,6 @@ def _status(
285283
jobs=None,
286284
show_checksums=False,
287285
download=False,
288-
clear_index=False,
289286
):
290287
"""Return a tuple of (dir_status_info, file_status_info, dir_mapping).
291288
@@ -313,9 +310,6 @@ def _status(
313310
else:
314311
logger.debug("Collecting information from remote cache...")
315312
remote_exists = set()
316-
if clear_index:
317-
logger.debug("--clear-index used, clearing remote index")
318-
remote.index.clear()
319313
dir_md5s = set(named_cache.dir_keys(self.scheme))
320314
if dir_md5s:
321315
remote_exists.update(
@@ -438,7 +432,6 @@ def _process(
438432
jobs=None,
439433
show_checksums=False,
440434
download=False,
441-
clear_index=False,
442435
):
443436
logger.debug(
444437
"Preparing to {} '{}'".format(
@@ -467,7 +460,6 @@ def _process(
467460
jobs=jobs,
468461
show_checksums=show_checksums,
469462
download=download,
470-
clear_index=clear_index,
471463
)
472464

473465
dir_plans = self._get_plans(download, remote, dir_status, status)
@@ -551,39 +543,23 @@ def _dir_upload(func, futures, from_info, to_info, name):
551543
return func(from_info, to_info, name)
552544

553545
@index_locked
554-
def push(
555-
self,
556-
named_cache,
557-
remote,
558-
jobs=None,
559-
show_checksums=False,
560-
clear_index=False,
561-
):
546+
def push(self, named_cache, remote, jobs=None, show_checksums=False):
562547
return self._process(
563548
named_cache,
564549
remote,
565550
jobs=jobs,
566551
show_checksums=show_checksums,
567552
download=False,
568-
clear_index=clear_index,
569553
)
570554

571555
@index_locked
572-
def pull(
573-
self,
574-
named_cache,
575-
remote,
576-
jobs=None,
577-
show_checksums=False,
578-
clear_index=False,
579-
):
556+
def pull(self, named_cache, remote, jobs=None, show_checksums=False):
580557
return self._process(
581558
named_cache,
582559
remote,
583560
jobs=jobs,
584561
show_checksums=show_checksums,
585562
download=True,
586-
clear_index=clear_index,
587563
)
588564

589565
@staticmethod

dvc/repo/fetch.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def _fetch(
2020
all_tags=False,
2121
recursive=False,
2222
all_commits=False,
23-
clear_index=False,
2423
):
2524
"""Download data items from a cloud and imported repositories
2625
@@ -51,11 +50,7 @@ def _fetch(
5150

5251
try:
5352
downloaded += self.cloud.pull(
54-
used,
55-
jobs,
56-
remote=remote,
57-
show_checksums=show_checksums,
58-
clear_index=clear_index,
53+
used, jobs, remote=remote, show_checksums=show_checksums
5954
)
6055
except NoRemoteError:
6156
if not used.external and used["local"]:

dvc/repo/pull.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def pull(
1818
force=False,
1919
recursive=False,
2020
all_commits=False,
21-
clear_index=False,
2221
):
2322
processed_files_count = self._fetch(
2423
targets,
@@ -29,7 +28,6 @@ def pull(
2928
all_commits=all_commits,
3029
with_deps=with_deps,
3130
recursive=recursive,
32-
clear_index=clear_index,
3331
)
3432
stats = self._checkout(
3533
targets=targets, with_deps=with_deps, force=force, recursive=recursive

dvc/repo/push.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def push(
1212
all_tags=False,
1313
recursive=False,
1414
all_commits=False,
15-
clear_index=False,
1615
):
1716
used = self.used_cache(
1817
targets,
@@ -25,4 +24,4 @@ def push(
2524
jobs=jobs,
2625
recursive=recursive,
2726
)
28-
return self.cloud.push(used, jobs, remote=remote, clear_index=clear_index)
27+
return self.cloud.push(used, jobs, remote=remote)

dvc/repo/status.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def _cloud_status(
4545
with_deps=False,
4646
all_tags=False,
4747
all_commits=False,
48-
clear_index=False,
4948
):
5049
"""Returns a dictionary with the files that are new or deleted.
5150
@@ -87,9 +86,7 @@ def _cloud_status(
8786
)
8887

8988
ret = {}
90-
status_info = self.cloud.status(
91-
used, jobs, remote=remote, clear_index=clear_index
92-
)
89+
status_info = self.cloud.status(used, jobs, remote=remote)
9390
for info in status_info.values():
9491
name = info["name"]
9592
status = info["status"]
@@ -114,7 +111,6 @@ def status(
114111
with_deps=False,
115112
all_tags=False,
116113
all_commits=False,
117-
clear_index=False,
118114
):
119115
if cloud or remote:
120116
return _cloud_status(
@@ -126,7 +122,6 @@ def status(
126122
remote=remote,
127123
all_tags=all_tags,
128124
all_commits=all_commits,
129-
clear_index=clear_index,
130125
)
131126

132127
ignored = list(

scripts/completion/dvc.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ _dvc_pipeline='list show'
5151
_dvc_pipeline_list=''
5252
_dvc_pipeline_show='-c --commands -o --outs --ascii --dot --tree -l --locked'
5353
_dvc_pipeline_show_COMPGEN=_dvc_compgen_DVCFiles
54-
_dvc_pull='-j --jobs -r --remote -a --all-branches -T --all-tags -f --force -d --with-deps -R --recursive --clear-index'
54+
_dvc_pull='-j --jobs -r --remote -a --all-branches -T --all-tags -f --force -d --with-deps -R --recursive'
5555
_dvc_pull_COMPGEN=_dvc_compgen_DVCFiles
56-
_dvc_push='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive --clear-index'
56+
_dvc_push='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive'
5757
_dvc_push_COMPGEN=_dvc_compgen_DVCFiles
5858
_dvc_remote='add default list modify remove'
5959
_dvc_remote_add='--global --system --local -d --default -f --force'
@@ -68,7 +68,7 @@ _dvc_repro_COMPGEN=_dvc_compgen_DVCFiles
6868
_dvc_root=''
6969
_dvc_run='--no-exec -f --file -d --deps -o --outs -O --outs-no-cache --outs-persist --outs-persist-no-cache -m --metrics -M --metrics-no-cache --overwrite-dvcfile --ignore-build-cache --no-commit -w --wdir'
7070
_dvc_run_COMPGEN=_dvc_compgen_DVCFiles
71-
_dvc_status='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -c --cloud --clear-index'
71+
_dvc_status='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -c --cloud'
7272
_dvc_status_COMPGEN=_dvc_compgen_DVCFiles
7373
_dvc_unlock_COMPGEN=_dvc_compgen_DVCFiles
7474
_dvc_unprotect_COMPGEN=_dvc_compgen_files

scripts/completion/dvc.zsh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ _dvc_pull=(
193193
{-d,--with-deps}"[Fetch cache for all dependencies of the specified target.]"
194194
{-f,--force}"[Do not prompt when removing working directory files.]"
195195
{-R,--recursive}"[Pull cache for subdirectories of the specified directory.]"
196-
{--clear-index}"[Clear local index for the remote.]"
197196
"*:Stages:_files -g '(*.dvc|Dvcfile)'"
198197
)
199198

@@ -204,7 +203,6 @@ _dvc_push=(
204203
{-T,--all-tags}"[Push cache for all tags.]"
205204
{-d,--with-deps}"[Push cache for all dependencies of the specified target.]"
206205
{-R,--recursive}"[Push cache for subdirectories of specified directory.]"
207-
{--clear-index}"[Clear local index for the remote.]"
208206
"*:Stages:_files -g '(*.dvc|Dvcfile)'"
209207
)
210208

@@ -265,7 +263,6 @@ _dvc_status=(
265263
{-a,--all-branches}"[Show status of a local cache compared to a remote repository for all branches.]"
266264
{-T,--all-tags}"[Show status of a local cache compared to a remote repository for all tags.]"
267265
{-d,--with-deps}"[Show status for all dependencies of the specified target.]"
268-
{--clear-index}"[Clear local index for the remote.]"
269266
"*:Stages:_files -g '(*.dvc|Dvcfile)'"
270267
)
271268

tests/func/remote/test_index.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ def test_indexed_dir_missing(tmp_dir, dvc, tmp_path_factory, remote):
6363
assert not list(remote.index.checksums())
6464

6565

66-
def test_clear_index(tmp_dir, dvc, tmp_path_factory, remote, mocker):
67-
mocked_clear = mocker.patch.object(remote.INDEX_CLS, "clear")
68-
dvc.status(cloud=True, clear_index=True)
69-
mocked_clear.assert_called_with()
70-
71-
7266
def test_clear_on_gc(tmp_dir, dvc, tmp_path_factory, remote, mocker):
7367
(foo,) = tmp_dir.dvc_gen({"foo": "foo content"})
7468
dvc.push()

0 commit comments

Comments
 (0)