1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
TITLE:: Git
summary:: git interface
categories:: Frontends
related:: Classes/Quarks, Classes/Quark
DESCRIPTION::
An interface to the git toolchain. For more information on git, see link::http://git.io::.
CLASSMETHODS::
METHOD:: new
creates a new instance of code::Git::, pointing to an existing local git repository.
argument:: localPath
path to the git repository.
METHOD:: isGit
returns code::true::, if a local directory is a git repository.
argument:: localPath
METHOD:: checkForGit
returns code::true::, if the git toolchain is found on the system.
INSTANCEMETHODS::
subsection:: info
METHOD:: branch
returns:: current branch name.
METHOD:: remote, url
returns:: url of the first remote that it finds.
METHOD:: remoteAsHttpUrl
Detects if the remote URI starts with code::"git@":: or code::"git:":: and remodels it to a valid code::"https":: URI. Otherwise, it returns the unaltered remote.
code::
// git-style remote URI's are transformed to https
Git().url_("git@github.com:foo/bar.git").remoteAsHttpUrl;
Git().url_("https://github.com/foo/bar").remoteAsHttpUrl;
Git().url_("git@foo.net:foo/bar.git").remoteAsHttpUrl;
// http and https are left untouched
Git().url_("https://foo.org/bar").remoteAsHttpUrl;
Git().url_("http://foo.org/bar").remoteAsHttpUrl;
// unknown URI styles are left untouched
Git().url_("fooBar").remoteAsHttpUrl;
::
returns:: remote URI formatted for code::http:: respectively code::https:: requests.
METHOD:: remoteLatest
returns:: hash of latest commit on the remote
METHOD:: localPath
returns:: path to local repository
METHOD:: tag
returns:: currently checked out tag
METHOD:: tags
returns:: avaliable tags
METHOD:: sha
returns:: hash of the currently checked out version
METHOD:: shaForTag
argument:: tag
one of the tags returned by link::#-tags::
returns:: hash of the given tag
METHOD:: isDirty
returns:: code::true:: if there are local changes
subsection:: perform actions on remote
METHOD:: fetch
perform a fetch from remote
METHOD:: checkout
perform a checkout from remote with argument code::refspec::
argument:: refspec
METHOD:: pull
perform a pull from remote
METHOD:: clone
perform a clone from url into link::#-localPath::
argument:: url
the url of the remotes
PRIVATE:: git, refspec
EXAMPLES::
code::
// create a Git that points to a Quark directory
g = Git(Quarks.all.choose.localPath);
// alternatively, provide a pathname to a local git repository:
g = Git("/path/to/local/repo");
// get all available tags
g.tags;
// return local path
g.localPath;
// return url
g.url;
::
|