From 0a58b170a2194a95d7381391eea430a717134a0d Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:32:14 -0600 Subject: [PATCH 1/8] Add and remove all the files in one git command This might fix #324. --- doctr/travis.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doctr/travis.py b/doctr/travis.py index 178032dc..4745831d 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -476,10 +476,9 @@ def commit_docs(*, added, removed): DOCTR_COMMAND = ' '.join(map(shlex.quote, sys.argv)) - for f in added: - run(['git', 'add', f]) - for f in removed: - run(['git', 'rm', f]) + + run(['git', 'add', *added]) + run(['git', 'rm', *removed]) commit_message = """\ Update docs after building Travis build {TRAVIS_BUILD_NUMBER} of From d15e30a78911ba959c3c2b7c3d21b7accc62c0f2 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:37:32 -0600 Subject: [PATCH 2/8] Test syncing lots of files --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 41a3504a..e51f7388 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,10 @@ script: python -m doctr deploy --sync --key-path deploy_key.enc "branch-whitelist" --branch-whitelist branch-whitelist; # Test --exclude python -m doctr deploy --sync --key-path deploy_key.enc "exclude-test" --built-docs docs/_build/html --exclude tests.html; + # Test syncing lots of files + mkdir lots-of-files-test; + python -c 'for i in range(10000): open("lots-of-files-test/test-%s" % i, "w")'; + python -m doctr deploy --sync --key-path deploy_key.enc lots-of-files-test" --built-docs lots-of-files-test; fi - if [[ "${TESTS}" == "true" ]]; then pyflakes doctr; From 332d7d06e0261e219f4b3e541576663cedde5a9b Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:38:00 -0600 Subject: [PATCH 3/8] Don't run git add or git rm if there are no files --- doctr/travis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doctr/travis.py b/doctr/travis.py index 4745831d..80a72c66 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -477,8 +477,10 @@ def commit_docs(*, added, removed): DOCTR_COMMAND = ' '.join(map(shlex.quote, sys.argv)) - run(['git', 'add', *added]) - run(['git', 'rm', *removed]) + if added: + run(['git', 'add', *added]) + if removed: + run(['git', 'rm', *removed]) commit_message = """\ Update docs after building Travis build {TRAVIS_BUILD_NUMBER} of From c461aea49abbc8de12e376a141efc29e4557c3a7 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:42:25 -0600 Subject: [PATCH 4/8] Use mkdir -p --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e51f7388..068b1a14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ script: # Test --exclude python -m doctr deploy --sync --key-path deploy_key.enc "exclude-test" --built-docs docs/_build/html --exclude tests.html; # Test syncing lots of files - mkdir lots-of-files-test; + mkdir -p lots-of-files-test; python -c 'for i in range(10000): open("lots-of-files-test/test-%s" % i, "w")'; python -m doctr deploy --sync --key-path deploy_key.enc lots-of-files-test" --built-docs lots-of-files-test; fi From 9f181c5867b88d59a9f94ee2958368c2ac653308 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:44:19 -0600 Subject: [PATCH 5/8] Try inverting the quotes --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 068b1a14..65d84296 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ script: python -m doctr deploy --sync --key-path deploy_key.enc "exclude-test" --built-docs docs/_build/html --exclude tests.html; # Test syncing lots of files mkdir -p lots-of-files-test; - python -c 'for i in range(10000): open("lots-of-files-test/test-%s" % i, "w")'; + python -c "for i in range(10000): open('lots-of-files-test/test-%s' % i, 'w')"; python -m doctr deploy --sync --key-path deploy_key.enc lots-of-files-test" --built-docs lots-of-files-test; fi - if [[ "${TESTS}" == "true" ]]; then From 3eea573c03f7c8653b93a8ce58ffefd3c36e8d7d Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:49:54 -0600 Subject: [PATCH 6/8] Delete extra quote --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65d84296..5e0cee53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ script: # Test syncing lots of files mkdir -p lots-of-files-test; python -c "for i in range(10000): open('lots-of-files-test/test-%s' % i, 'w')"; - python -m doctr deploy --sync --key-path deploy_key.enc lots-of-files-test" --built-docs lots-of-files-test; + python -m doctr deploy --sync --key-path deploy_key.enc lots-of-files-test --built-docs lots-of-files-test; fi - if [[ "${TESTS}" == "true" ]]; then pyflakes doctr; From aef11128c063306ac08ff84bc69a9e77f8294798 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 21:55:17 -0600 Subject: [PATCH 7/8] Test adding the "slow" way See if my test in .travis.yml really does test the right thing. --- doctr/travis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctr/travis.py b/doctr/travis.py index 80a72c66..6900b3cf 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -477,8 +477,8 @@ def commit_docs(*, added, removed): DOCTR_COMMAND = ' '.join(map(shlex.quote, sys.argv)) - if added: - run(['git', 'add', *added]) + for f in added: + run(['git', 'add', f]) if removed: run(['git', 'rm', *removed]) From b6628cea60738057f410a78df6f396ceed8bd30c Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 18 Sep 2018 22:03:14 -0600 Subject: [PATCH 8/8] Revert "Test adding the "slow" way" This reverts commit aef11128c063306ac08ff84bc69a9e77f8294798. --- doctr/travis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctr/travis.py b/doctr/travis.py index 6900b3cf..80a72c66 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -477,8 +477,8 @@ def commit_docs(*, added, removed): DOCTR_COMMAND = ' '.join(map(shlex.quote, sys.argv)) - for f in added: - run(['git', 'add', f]) + if added: + run(['git', 'add', *added]) if removed: run(['git', 'rm', *removed])