Reputation: 129
I am using PySVN to checkout and update from a repo but don't want to checkout the entire repo. I only want certain folders and files so I am thinking I need to a sparse checkout and update on the files and folders i want.
My repo structure (example)
\Repo1
\animals
\dogs
\cats
\fish
\automobiles
\cars
\motorcycles
\aircraft
I can do a sparse checkout via the following code of a single directory with the following code:
def run_remote(client,remote_path, local_path):
# sparse checkout
client.checkout(remote_path, local_path,depth=pysvn.depth.empty)
def update_remote(client,update_local_test_path, local_path):
client.update(update_local_test_path,depth=pysvn.depth.infinity)
if __name__ == "__main__":
import pysvn
import os
import pprint
DESKTOP_PATH = os.path.join(os.path.expanduser("~"), 'Desktop')
REPO_SVN_URL = "https://snv-test/repo1"
REMOTE_TEST_PATH = "https://snv-test/repo1/animals"
LOCAL_TEST_PATH = os.path.join(DESKTOP_PATH, 'repo1')
#c:\users\desktop\repo1
UPDATE_LOCAL_TEST_PATH = os.path.join(LOCAL_TEST_PATH, 'animals')
#c:\users\desktop\repo1\animals
client = pysvn.Client()
client.callback_get_login = login
client.callback_notify = notify
run_remote(client, REMOTE_TEST_PATH, LOCAL_TEST_PATH)
update_remote(client, UPDATE_LOCAL_TEST_PATH, LOCAL_TEST_PATH)
# FUTURE: LOOP THROUGH DIRECTORIES AND DO MULTIPLE UPDATES
# FUTRE: UPDATE DIRECTORIES BY REVISION
# FUTURE: GET CURRENT REVISION NUMBERS
My code runs the checkout successfully and creates a local folder called 'repo1' that is empty. The update runs with no errors, but does not perform any update. Meaning, no folders are added to the 'repo1' folder. I was expecting the 'animals" directory with all folders and files to be updated locally. I suspect i do not have my update arguments correct.
The ultimate goal is to have a list of directories i want to be able to configure to automate a checkout/update and even do an update by revision eventually. Just want to get the checkout and update working. I am sure there may be more efficient was to do this. Thanks in advance.
Upvotes: 0
Views: 1028