Git Repository Manager

class datatoolbox.database.GitRepository_Manager(config, debugmode=False)[source]

# Management of git repositories for fast access

check_for_new_remote_data(force_check=False, foreground=False)[source]

Checks if source is in online repositorty

Parameters

force_checkTYPE, optional

DESCRIPTION. The default is False.

foregroundTYPE, optional

DESCRIPTION. The default is False.

Returns

None.

check_if_online_repo_exists(sourceID)[source]

Check if source in local inventory

Parameters

sourceIDTYPE

DESCRIPTION.

Returns

TYPE

DESCRIPTION.

clone_source_from_remote(repoName, repoPath)[source]

Function to clone a remote git repository as a local copy.

Input

repoName : str - valid repository in the remove database repoPath : str - path of the repository

commit(message)[source]

Function to commit all oustanding changes to git. All repos including ‘main’ are commited if there is any change

Input

message : str - commit message

create_remote_repo(repoName)[source]

Function to create a remote git repository from an existing local repo

get_source_repo_failsave(sourceID)[source]

Retrieve sourceID from repositories dictionary without checks

gitAddFile(repoName, filePath)[source]

Addes a new file to a repository

Input

repoName : str filePath : str of the relative file path

gitRemoveFile(repoName, filePath)[source]

Removes a file from the git repository

Input

repoName : str filePath : str of the relative file path

gitRemoveFiles(repoName, filePaths)[source]

Removes mutiple file from the git repository

Input

repoName : str filePath : str of the relative file path

init_new_repo(repoPath, repoID, sourceMetaDict)[source]

Method to create a new repository for a source

Input

repoPath : str repoID : str sourceMetaDict : dict with the required meta data descriptors

pull_update_from_remote(repoName, old_inventory)[source]

This function used git pull an updated remote source dataset to the local database.

Input is the source ID as a str.

Currently conflicts beyond auto-conflict management are not caught by this function. TODO

push_to_remote_datashelf(repoName, force=True)[source]

This function used git push to update the remote database with an updated source dataset.

Input is the source ID as a str.

Currently conflicts beyond auto-conflict management are not caught by this function. TODO

setActive(repoName)[source]

Function to set a reposity active

test_ssh_remote_connection()[source]

Function to test the ssh connection to the remote data repository using ‘ssh -T host’ Returns ——- None.

updateGitHash_and_Tag(repoName)[source]

Function to update the git hash code in the sources.csv by the repo hash code

verifyGitHash(repoName)[source]

Function to verify the git hash code of an existing git repository