format_patch_helper: make "output" a keyword arg
[python-git.git] / README.txt
blob41f87418436e820592541b63409b3bcf0f8647ee
1 python-git: Copyright (c) 2008 David Aguilar
3 The git module is a wrapper around the git command line interface.
4 Any git command can be called by simply calling a function of
5 the same name as the git command.
7 The command's output is returned in a string.
9 Passing the optional with_status=True keyword
10 causes the function to returns a tuple of (status, output) instead.
12 To specify a dashed option, such as "--index", pass the name
13 of the option as a keyword parameter set to true.
15 To specify options with dashes in their name, use
16 underscores.  For example, --patch-with-raw becomes patch_with_raw.
17 This applies to the command names as well.
19         import git
21         print git.rev_parse('HEAD')
22         print git.diff('--', 'foo', cached=True)
23         print git.commit('foo', F='COMMIT_MSG', s=True)
24         print git.log('HEAD^..HEAD', patch_with_raw=True, abbrev=4)
26 Results in the following commands being executed:
28         [ 'git', 'rev-parse', 'HEAD' ]
29         [ 'git', 'diff', '--cached', '--', 'foo' ]
30         [ 'git', 'commit', '-FCOMMIT_MSG', '-s', 'foo' ]
31         [ 'git', 'log', '--abbrev=4', '--patch-with-raw', 'HEAD^..HEAD' ]
33 Example:
35 >>> git.foo(with_status=True)
36 (1, "git: 'foo' is not a git-command. See 'git --help'.")
39 The strings returned by this module strip off trailing whitespace by
40 default since it simplifies command usage.  To avoid that pass
41 raw=True into any git.<command> function.
43 All git functions specified in the split string list below are present
44 in the git.commands dictionary at import time.  Any that are not
45 specified are added dynamically as modules import or use them.
47 For example:
48         import git
49         print git.foo()
51 Is perfectly valid but will raise an exception since git will return
52 exit status 1.  To not raise exceptions, users can set
53 git.RAISE_EXCEPTIONS=False or pass allow_errors=True to an
54 individual command:
56         print git.foo(allow_errors=True)
58 would continue and print the standard git error message:
60 git: 'foo' is not a git-command. See 'git --help'.
62 Had git actually found a git-foo command, then its output would have
63 been returned instead (as expected).
65 This is to allow seamless upgradeability with future as well as
66 seamless integration with custom, user-defined git commands.
68 What this means is that the list of git commands included in this
69 file is not strictly required for the proper execution of this module.
70 We include the list, though, to provide convenience for users who
71 use the python console's tab completion facilities.