summaryrefslogtreecommitdiff
path: root/lib/git/cmd.py
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2008-06-15 17:03:53 -0700
committerDavid Aguilar <davvid@gmail.com>2008-06-15 17:03:53 -0700
commit3980f11a9411d0b487b73279346cfae938845e7a (patch)
tree85977ee41ee5d18de056f0661ef2a5622cce7dd9 /lib/git/cmd.py
parent579e2c07bbb39577fa32fed8cb42297c1c5516d8 (diff)
downloadgitpython-3980f11a9411d0b487b73279346cfae938845e7a.tar.gz
cmd: rename with_keep_cwd to keep_cwd
Having execute() use a different directory is an important piece of API information so I added more documentation about it and renamed the flag to just "keep_cwd" since that's shorter and simpler. Signed-off-by: David Aguilar <davvid@gmail.com>
Diffstat (limited to 'lib/git/cmd.py')
-rw-r--r--lib/git/cmd.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index bd8da4ca..029fcbc9 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -77,11 +77,11 @@ class Git(MethodMissingMixin):
def execute(self, command,
istream=None,
+ keep_cwd=False,
with_status=False,
with_stderr=False,
with_exceptions=False,
with_raw_output=False,
- with_keep_cwd=False,
):
"""
Handles executing the command on the shell and consumes and returns
@@ -93,6 +93,11 @@ class Git(MethodMissingMixin):
``istream``
Standard input filehandle passed to subprocess.Popen.
+ ``keep_cwd``
+ Whether to use the current working directory from os.getcwd().
+ GitPython uses get_work_tree() as its working directory by
+ default and get_git_dir() for bare repositories.
+
``with_status``
Whether to return a (status, str) tuple.
@@ -105,9 +110,6 @@ class Git(MethodMissingMixin):
``with_raw_output``
Whether to avoid stripping off trailing whitespace.
- ``with_keep_cwd``
- Whether to use the current working directory from os.getcwd().
-
Returns
str(output) # with_status = False (Default)
tuple(int(status), str(output)) # with_status = True
@@ -124,7 +126,7 @@ class Git(MethodMissingMixin):
stderr = subprocess.PIPE
# Allow the user to have the command executed in their working dir.
- if with_keep_cwd:
+ if keep_cwd:
cwd = os.getcwd()
else:
cwd=self._cwd
@@ -214,11 +216,11 @@ class Git(MethodMissingMixin):
# Handle optional arguments prior to calling transform_kwargs
# otherwise these'll end up in args, which is bad.
istream = kwargs.pop("istream", None)
+ keep_cwd = kwargs.pop("keep_cwd", None)
with_status = kwargs.pop("with_status", None)
with_stderr = kwargs.pop("with_stderr", None)
with_exceptions = kwargs.pop("with_exceptions", None)
with_raw_output = kwargs.pop("with_raw_output", None)
- with_keep_cwd = kwargs.pop("with_keep_cwd", None)
# Prepare the argument list
opt_args = self.transform_kwargs(**kwargs)
@@ -230,9 +232,9 @@ class Git(MethodMissingMixin):
return self.execute(call,
istream = istream,
+ keep_cwd = keep_cwd,
with_status = with_status,
with_stderr = with_stderr,
with_exceptions = with_exceptions,
with_raw_output = with_raw_output,
- with_keep_cwd = with_keep_cwd,
)