Commit Graph
79 Commits
Author SHA1 Message Date
Saugat Pachhai a7aecf7c82 s3/gs: do not try to make directory on top level path (#3524)
* s3/gs: do not try to make directory on top level

* tests: unittest makedirs for s3 and gs

* remove setattr and use patch.object

* Update tests/unit/remote/test_remote.py
2020-03-27 16:25:43 +02:00
Saugat Pachhai 1455e9551e pull/checkout: fix empty output if no state gets changed (#3520) 2020-03-24 13:48:06 +02:00
Saugat Pachhai 9fd7d747c1 pull: support pulling git-only imports (#3503)
* pull: support pulling git-only imports

* pull: also add git imports from external dvc repo

* fetch: add logging

* pull: don't save link to state

When `checkout` or `pull` is done, it'll try to cleanup unused links.
So, when we add from erepo to cache, it creates a link, which DVC will try
to cleanup. Also, it'll provide unwanted checkout change details. So, skipping those

* tests: refactor/rewrite

* flake8: why it's complaining?

* tests: do not leak file descriptors
2020-03-24 13:45:51 +02:00
Saugat Pachhai 205a605887 external_repo: do not try too hard to fix upstream (#3512)
* tests: importing from bare repo

* external_repo: don't try too hard to set upstream repo especially if url is not a dvc repo.

* Update tests/func/test_import.py

* Add a comment regarding bare-repo clone
2020-03-20 15:54:47 +02:00
Saugat Pachhai 84760dc738 stage: reorganize check for stage paths and exceptions (#3509) 2020-03-19 14:35:12 +02:00
Saugat Pachhai 93246f0658 version: fix bug when .git dir is removed, show more info regarding repo (#3508)
* version: fix error when .git dir is removed

* version: show dvc/git information

* version: remove introducing no_scm params in Repo api
2020-03-19 13:06:34 +02:00
Saugat Pachhai 4b5d4d759a gc: do not work without specifier when using -c flag (#3493)
* gc: ask for specifier when using -c flag

* tests: add -w flag with gc -c
2020-03-17 18:12:42 +02:00
Saugat Pachhai e1334448ea completion: add --summary flag on checkout (#3491) 2020-03-17 14:04:12 +02:00
Saugat PachhaiandCasper da Costa-Luis 109ded4068 dvc: support Python3.8 (#3463)
* py38: make wheels

- ci: set ARROW_LIBHDFS_DIR to load native library
- deps: pin pyarrow to 0.15.1 for py<=3.7
- pin deps for python<3.8
- pin deps for python==3.8 as well
- add windows Py38 on travis
- do not use speedcopy for Python3.8 and Windows

* use realpath to resolve symbolic links

* do not build pkgs for Windows and Linux on Python3.8

* reorder

* pyarrow: document regression fix

Co-authored-by: Casper da Costa-Luis <[email protected]>
2020-03-16 19:18:33 +00:00
Saugat Pachhai 1b21789444 exceptions: use semantic exceptions (#3430) 2020-03-16 19:39:59 +02:00
Saugat PachhaiandJorge Orpinel 066ccea733 checkout: show summary by default and introduce --show-changes flag (#3401)
* checkout: implement --show-changes flag to show detailed checkout details
Show summary by default on checkout

checkout: show directory modified even when files are removed from inside it

checkout: refactor template logic

checkout: change output format

checkout: do not show summary if nothing's changed

checkout: do not show summary if show_changes is specified

checkout: show '/' at the end if it's a directory

rename variable name

test: cover stats for checkout

checkout: show relink as not modified

checkout: remove unwanted message during empty checkout

pull: show summary on checkout

import/get: change external_repo to catch CheckoutError

fix tests and check if path is url

checkout: support external deps/outputs

tests: checkout on external outputs

* fix tests

* checkout: make show changes default and introduce summary flag to show summary

* address suggestions

* exceptions: remove extra spacing on erorr

* Update dvc/command/checkout.py

Co-Authored-By: Jorge Orpinel <[email protected]>

Co-authored-by: Jorge Orpinel <[email protected]>
2020-03-16 16:29:36 +02:00
Saugat Pachhai d2734dfe1e tests: remove use of mocker as context-manager (#3480) 2020-03-16 08:25:22 +05:45
Saugat Pachhai 682275dc0a add: do not verify hardlink if file is empty (#3428)
* add: do not verify hardlink if file is empty

Fixes #3390

* tests: spy

* fixup! tests: spy
2020-03-11 21:56:12 +02:00
Saugat Pachhai 7f94518008 deps: upgrade jsonpath_ng to latest version (#3464)
Fix #3456
2020-03-10 11:18:52 +02:00
Saugat Pachhai ea981ae955 gc: make --all-commits flag visible (#3429)
* gc: make --all-commits visible

* gc: fix help message and completion scripts

* bash: add longform --workspace flag
2020-03-10 08:29:07 +05:45
Saugat Pachhai 5101bf1253 gc: make it safer by only activating by use of certain flags (#3363)
* gc: make it safer by only activating by use of certain flags

Previous plain `gc` is now not supported. The same behavior can be trigger by
`gc -w` or `gc --workspace`. When `--all-{tags, commits, branches}` are
specified, it will work as if `-w` is also specified (same as before).

* tests: adjust gc to use workspace on test_repro
2020-02-21 12:39:59 +02:00
Saugat Pachhai 46e5053705 update: support specifying revision when updating (#3337)
* update: work with rev

* completion: update --rev completion scripts

* test: fix unit test assumption

* test: use fspath_py35
2020-02-15 17:55:41 +02:00
Saugat Pachhai 77f24af727 dvc: do not set cache dir if not a dvc repo (#3329) 2020-02-14 19:07:23 +02:00
Saugat Pachhai a317e59df1 tests: fix typo on gdrive_client_secret (#3327) 2020-02-14 17:04:27 +02:00
Saugat Pachhai 0daf835ae9 checkout: change level to debug and fix message (#3326) 2020-02-14 15:44:16 +02:00
Saugat Pachhai 17c7b72cb0 logger: log datetime when on debug mode (#3325) 2020-02-14 13:58:15 +02:00
Saugat Pachhai 8610c0c95e repo: raise exception if root_dir is not a directory path (#3295)
* repo: throw if root_dir in Repo.__init__() is not a directory path

When Repo is instantiated with invalid urls such as 'http://github.com/iterative/dvc.git',
it does os.path.realpath which is not intelligent enough and just concatenates with current
working directory, which is then traversed outward. It might happen that the outward folder
is a dvc directory which is not really what we want.

So, a check for root to be a directory is added. Otherwise, NotDvcRepoError is thrown with
a custom message.

* repo: set message from raise for NotDvcRepoError
2020-02-10 20:57:34 +02:00
Saugat Pachhai 2e0b143856 api: use current directory for repo if not specified 2020-01-23 15:28:22 +05:45
Saugat Pachhai 003b5c392a api: fallback to external_repo on error 2020-01-23 14:44:38 +05:45
Saugat Pachhai 5f8b1f7f80 brancher: do not get tree if there's no revs 2020-01-22 17:22:54 +05:45
Saugat Pachhai df1ba08b94 exception: fix spelling 2020-01-21 17:24:21 +05:45
Saugat Pachhai 8dd2dbb46e py2: remove use of six 2020-01-20 21:47:56 +05:45
Saugat PachhaiandPaweł Redzyński 98f6d56e8c test: refactor, apply suggestion from @pared
Co-Authored-By: Paweł Redzyński <[email protected]>
2020-01-16 22:59:58 +05:45
Saugat Pachhai 02a73a0d9b unit: test: check output of get --show-url command 2020-01-16 22:52:35 +05:45
Saugat Pachhai 50206d44dc test: fix test related to path on windows
On windows, `str(exc_info)` is returning escaped path, eg:
'<ExceptionInfo UrlNotDvcRepoError("URL \'C:\\\\Users\\\\travis\\\\AppData\\\\Local\\\\Temp\\\\pytest-of-travis\\\\pytest-0\\\\popen-gw2\\\\test_get_url_git_only_repo_thr0\' is not a dvc repository.") tblen=2>'

This commit just replaces the double slashes with single one. Bit of a hack, I know.
2020-01-16 21:06:52 +05:45
Saugat Pachhai aa7119a741 get: test get_url raises exception if not a dvc repo 2020-01-16 19:28:14 +05:45
Saugat Pachhai f130e18e2c get: use new exception from public api 2020-01-16 19:28:14 +05:45
Saugat Pachhai fadf60eea6 api: throw exception by get_url if not a dvc repo 2020-01-16 19:28:14 +05:45
Saugat Pachhai eb252e055b get: split command for getting url and getting files from url functions 2020-01-16 19:28:14 +05:45
Saugat Pachhai 4509f82bc3 get: implement --show-url to display only url/path to remote 2020-01-16 19:28:14 +05:45
Saugat Pachhai 7993600019 test: use helper remotes in external repro 2020-01-14 23:31:44 +05:45
Saugat Pachhai 45b97b14c4 test: use helper remotes in child of TestDataCloudCLIBase 2020-01-14 20:29:29 +05:45
Saugat Pachhai 37b9d32e04 test: refactor: use helper remotes in TestCases 2020-01-14 19:25:19 +05:45
Saugat Pachhai a27910d71d test: merge local related function in Local helper class 2020-01-14 14:04:02 +05:45
Saugat Pachhai 26d85f1a52 test: merge gcp related functions to GCP helper class 2020-01-13 23:49:22 +05:45
Saugat Pachhai d55427dbd9 test: refactor hdfs related functions in HDFS test helpers 2020-01-13 16:30:15 +05:45
Saugat Pachhai 141f308a6a test: refactor ssh related functions in SSH and SSHMocked test helpers 2020-01-13 14:23:42 +05:45
Saugat Pachhai 78dd4896ca test: merge _should_test_aws and _get_aws_url inside S3 test helper 2020-01-06 22:08:28 +05:45
Saugat Pachhai 96c87d5643 test: merge _should_oss_azure and _get_oss_url inside OSS class 2020-01-05 10:25:01 +05:45
Saugat Pachhai c0616fcee2 test: add _should_test_gdrive and _get_gdrive_url inside GDrive 2020-01-04 22:03:49 +05:45
Saugat Pachhai c4783f4930 test: merge _should_test_azure and _get_azure_url inside Azure class 2020-01-04 21:54:12 +05:45
Saugat Pachhai 6ba7b1d9a3 gs: adjust tests 2019-12-01 17:26:07 +05:45
Saugat Pachhai 37fcced4ad s3: raise exception if not 404 status code 2019-12-01 16:28:31 +05:45
Saugat Pachhai 4f011f62c7 use yield and staticmethod 2019-12-01 16:24:22 +05:45
Saugat Pachhai 22c0a644e5 address @efiop's suggestions 2019-12-01 16:08:53 +05:45
Saugat Pachhai 4821aa2efa s3: catch specific exception when head_object() 2019-12-01 14:47:56 +05:45
Saugat Pachhai da0d9e8599 s3: implement isfile() 2019-12-01 10:58:53 +05:45
Saugat Pachhai f4f836e17c Merge branch 'master' into gs-external-deps
* master:
  travis: windows: use python 3.7.5
  test: skip non supported remotes fast in api tests
2019-12-01 09:01:47 +05:45
Saugat Pachhai 7e62a7d7e5 gs: implement isfile 2019-12-01 08:56:07 +05:45
Saugat Pachhai 25f0e0765c gs: use Blob.exists() instead of _list_paths to check for blob 2019-12-01 08:25:50 +05:45
Saugat Pachhai 2e1f3114cd dvc: write tests 2019-11-30 19:47:30 +05:45
Saugat Pachhai 13e5dbafd0 s3: check for all files in given path 2019-11-30 19:20:32 +05:45
Saugat Pachhai 433d2f8017 test: remove nested contextmanagers, return False on exists() 2019-11-30 19:12:35 +05:45
Saugat Pachhai 8a62e2f92b gs: check if the path is directory when checking for exists 2019-11-30 18:03:41 +05:45
Saugat Pachhai 42991d3b75 Move more stuff from data_cloud to tests/remotes.py 2019-11-30 10:04:45 +05:45
Saugat Pachhai 63cf117ee9 Move to tests/remotes.py 2019-11-30 08:58:43 +05:45
Saugat Pachhai 4714929b5b Merge branch 'master' into gs-external-deps
* master:
  address @efiop's suggestions
  s3: add support for top level empty directories
  remote: http: calculate length basing on response and not head call
  test: remote: http: clear test file name
  HTTPError: reformat error message
  Update dvc/remote/http.py
  remote: http: rename http error, refactor test
  remote: http: raise exception when download response with error status code
  Support GDrive as remote
  setup: don't forget contextlib2
  remote: refactor ssh ask password code
  remote: protect all remote client/session creation code with locks
  test: refactor & remove redundant test fixtures
  NoRemoteInExternalRepoError: dont pass cause of exception
  perf: optimize cache listing for local, ssh and hdfs
  remote: small .save_info()/.get_checksum() cleanup
2019-11-30 08:39:56 +05:45
Saugat Pachhai caa67c725e dvc: refactor tests 2019-11-30 08:22:39 +05:45
Saugat Pachhai ee69ac835d gs: make it work with empty dir 2019-11-29 07:24:11 +05:45
Saugat Pachhai 54dd9890dc gs: return relative path in list_cache_paths 2019-11-28 07:37:14 +05:45
Saugat Pachhai db12416eac remove extra args 2019-11-28 06:05:30 +05:45
Saugat Pachhai fe248aa130 dvc: use replace instead of posixpath 2019-11-28 05:47:04 +05:45
Saugat Pachhai 0c08c09e5d dvc: append slash at the end for dir path_info 2019-11-28 05:45:30 +05:45
Saugat Pachhai 5e2150d509 remote/gs: set max_results to improve performance when checking exists/isdir 2019-11-28 00:07:49 +05:45
Saugat Pachhai e750496123 remote/gs: support adding directories 2019-11-28 00:07:49 +05:45
Saugat Pachhai 461a79e1e8 Fix typos 2019-11-26 20:07:20 +05:45
Saugat Pachhai 7a678f3322 dvc: fix grammar in PR template 2019-11-24 15:44:42 +05:45
Saugat Pachhai 2859b53cae dvc: fix typo in data_cloud.py module docstring 2019-11-24 15:38:54 +05:45
saugat pachhai 9ae74073f2 dvc: remove extra newline 2019-11-22 05:36:06 +05:45
Saugat Pachhai 751bdb2197 dvc: refactor startswith usage with path_isin util 2019-11-21 22:22:08 +05:45
Saugat Pachhai 83c8ab5c26 test: Refactor tests 2019-11-19 21:55:13 +05:45
Saugat Pachhai 58624e0230 utils/fs: use fspath_py35 instead of fspath 2019-11-19 21:55:01 +05:45
Saugat Pachhai f07a70a052 get/import: display path relative to temporary repo 2019-11-19 05:36:11 +05:45
Saugat Pachhai 68c7366ef0 utils: implement path_isin to compare child and parent paths 2019-11-19 05:34:33 +05:45