module loghelper.repositories.pygit_helper
¶
Short summary¶
module pyquickhelper.loghelper.repositories.pygit_helper
Uses git to get version number.
Functions¶
function |
truncated documentation |
---|---|
Private function, tries to find a file |
|
Clones a git repository. |
|
Gets the command line used to run git. |
|
Returns information about a file. |
|
Returns information about all files |
|
Returns the last modification of a file. |
|
Gets the remote master location. |
|
Returns the number of commit. |
|
Gets the latest changes operated on a file in a folder or a subfolder. |
|
Gets the latest check for a specific path or version number based on the date (if usedate is True). If usedate … |
|
Says if it a repository GIT. |
|
Converts a date into a datetime. |
|
Runs |
|
Runs |
Documentation¶
Uses git to get version number.
-
exception
pyquickhelper.loghelper.repositories.pygit_helper.
GitException
[source][source]¶ Bases:
Exception
Exception raised by this module.
-
pyquickhelper.loghelper.repositories.pygit_helper.
IsRepo
(location, commandline=True)[source][source]¶ Says if it a repository GIT.
- Parameters
location – (str) location
commandline – (bool) use commandline or not
- Returns
bool
-
class
pyquickhelper.loghelper.repositories.pygit_helper.
RepoFile
(**args)[source][source]¶ Bases:
object
Mimic a GIT file.
- Parameters
args – list of members to add
-
pyquickhelper.loghelper.repositories.pygit_helper.
__get_version_from_version_txt
(path)[source][source]¶ Private function, tries to find a file
version.txt
which should contains the version number (if svn is not present).- Parameters
path – folder to look, it will look to the the path of this file, some parents directories and finally this path
- Returns
the version number
Warning
If
version.txt
was not found, it throws an exception.
-
pyquickhelper.loghelper.repositories.pygit_helper.
clone
(location, srv, group, project, username=None, password=None, fLOG=None)[source][source]¶ Clones a git repository.
- Parameters
location – location of the clone
srv – git server
group – group
project – project name
username – username
password – password
fLOG – logging function
- Returns
output, error
See How to provide username and password when run “git clone git@remote.git”?
Clone a git repository
clone("local_folder", "github.com", "sdpython", "pyquickhelper")
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_cmd_git
()[source][source]¶ Gets the command line used to run git.
- Returns
string
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_file_details
(name, path=None, commandline=True)[source][source]¶ Returns information about a file.
- Parameters
name – name of the file
path – path to repo
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
- Returns
list of tuples
The result is a list of tuple:
commit
name
added
inserted
bytes
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_file_details_all
(path=None, commandline=True)[source][source]¶ Returns information about all files
- Parameters
path – path to repo
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
- Returns
list of tuples
The result is a list of tuple:
commit
name
net
bytes
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_file_last_modification
(path, commandline=True)[source][source]¶ Returns the last modification of a file.
- Parameters
path – path to look
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
- Returns
integer
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_master_location
(path=None, commandline=True)[source][source]¶ Gets the remote master location.
- Parameters
path – path to look
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
- Returns
integer (check in number)
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_nb_commits
(path=None, commandline=True)[source][source]¶ Returns the number of commit.
- Parameters
path – path to look
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
- Returns
integer
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_repo_log
(path=None, file_detail=False, commandline=True, subset=None)[source][source]¶ Gets the latest changes operated on a file in a folder or a subfolder.
- Parameters
path – path to look
file_detail – if True, add impacted files
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
subset – only provide file details for a subset of files
- Returns
list of changes, each change is a list of tuple (see below)
The return results is a list of tuple with the following fields:
author
commit hash [:6]
date (datetime)
comment$
full commit hash
link to commit (if the repository is http://…)
The function use a command line if an error occurred. It uses the xml format:
<logentry revision="161"> <author>xavier dupre</author> <date>2013-03-23T15:02:50.311828Z</date> <msg>pyquickhelper: first version</msg> <hash>full commit hash</hash> </logentry>
Add link:
https://github.com/sdpython/pyquickhelper/commit/8d5351d1edd4a8997f358be39da80c72b06c2272
More: git pretty format See also pretty format (html). To get details about one file and all the commit.
git log --stat -- _unittests/ut_loghelper/data/sample_zip.zip
For some reason, the call to
str2datetime
seemed to cause exception such as:File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
when it was used to generate documentation for others modules than pyquickhelper. Not using this function helps. The cause still remains obscure.
-
pyquickhelper.loghelper.repositories.pygit_helper.
get_repo_version
(path=None, commandline=True, usedate=False, log=False)[source][source]¶ Gets the latest check for a specific path or version number based on the date (if usedate is True). If usedate is False, it returns a mini hash (a string then).
- Parameters
path – path to look
commandline – if True, use the command line to get the version number, otherwise it uses pysvn
usedate – if True, it uses the date to return a minor version number (1.1.thisone)
log – if True, returns the output instead of a boolean
- Returns
integer)
-
pyquickhelper.loghelper.repositories.pygit_helper.
my_date_conversion
(sdate)[source][source]¶ Converts a date into a datetime.
- Parameters
sdate – string
- Returns
date
-
pyquickhelper.loghelper.repositories.pygit_helper.
rebase
(location, srv, group, project, username=None, password=None, fLOG=None)[source][source]¶ Runs
git pull -rebase
on a repository.- Parameters
location – location of the clone
srv – git server
group – group
project – project name
username – username
password – password
fLOG – logging function
- Returns
output, error