summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-11-16 21:09:47 +0100
committerAntoine Musso <hashar@free.fr>2014-11-16 21:09:47 +0100
commitc8e70749887370a99adeda972cc3503397b5f9a7 (patch)
tree38e1241fd6d756f783b6b56dc6628ac3ca41ed4f
parentbed3b0989730cdc3f513884325f1447eb378aaee (diff)
downloadgitpython-c8e70749887370a99adeda972cc3503397b5f9a7.tar.gz
pep8 linting (trailing whitespace)
W291 trailing whitespace
-rw-r--r--git/__init__.py4
-rw-r--r--git/cmd.py80
-rw-r--r--git/config.py46
-rw-r--r--git/db.py10
-rw-r--r--git/diff.py40
-rw-r--r--git/exc.py2
-rw-r--r--git/index/base.py72
-rw-r--r--git/index/fun.py20
-rw-r--r--git/index/typ.py6
-rw-r--r--git/index/util.py6
-rw-r--r--git/objects/__init__.py2
-rw-r--r--git/objects/base.py14
-rw-r--r--git/objects/commit.py66
-rw-r--r--git/objects/fun.py18
-rw-r--r--git/objects/submodule/base.py84
-rw-r--r--git/objects/submodule/root.py60
-rw-r--r--git/objects/submodule/util.py8
-rw-r--r--git/objects/tag.py8
-rw-r--r--git/objects/tree.py34
-rw-r--r--git/objects/util.py34
-rw-r--r--git/odict.py4
-rw-r--r--git/refs/head.py22
-rw-r--r--git/refs/log.py28
-rw-r--r--git/refs/reference.py10
-rw-r--r--git/refs/remote.py6
-rw-r--r--git/refs/symbolic.py66
-rw-r--r--git/refs/tag.py14
-rw-r--r--git/remote.py106
-rw-r--r--git/repo/base.py82
-rw-r--r--git/repo/fun.py10
-rw-r--r--git/test/lib/asserts.py4
-rw-r--r--git/test/lib/helper.py34
-rw-r--r--git/test/performance/lib.py6
-rw-r--r--git/test/performance/test_commit.py12
-rw-r--r--git/test/performance/test_streams.py10
-rw-r--r--git/test/performance/test_utils.py4
-rw-r--r--git/test/test_base.py8
-rw-r--r--git/test/test_commit.py20
-rw-r--r--git/test/test_config.py2
-rw-r--r--git/test/test_diff.py12
-rw-r--r--git/test/test_fun.py6
-rw-r--r--git/test/test_git.py2
-rw-r--r--git/test/test_index.py52
-rw-r--r--git/test/test_reflog.py4
-rw-r--r--git/test/test_refs.py24
-rw-r--r--git/test/test_remote.py54
-rw-r--r--git/test/test_repo.py30
-rw-r--r--git/test/test_submodule.py24
-rw-r--r--git/test/test_tree.py2
-rw-r--r--git/util.py74
50 files changed, 673 insertions, 673 deletions
diff --git a/git/__init__.py b/git/__init__.py
index 17cd890d..d87dcbdb 100644
--- a/git/__init__.py
+++ b/git/__init__.py
@@ -41,8 +41,8 @@ from git.repo import Repo
from git.remote import *
from git.index import *
from git.util import (
- LockFile,
- BlockingLockFile,
+ LockFile,
+ BlockingLockFile,
Stats,
Actor
)
diff --git a/git/cmd.py b/git/cmd.py
index 3ec5a480..042a528d 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -6,19 +6,19 @@
import os, sys
from util import (
- LazyMixin,
+ LazyMixin,
stream_copy
)
from exc import GitCommandError
from subprocess import (
- call,
+ call,
Popen,
PIPE
)
execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
- 'with_exceptions', 'as_process',
+ 'with_exceptions', 'as_process',
'output_stream')
__all__ = ('Git', )
@@ -40,7 +40,7 @@ class Git(LazyMixin):
rval = g.ls_files() # calls 'git ls-files' program
``Debugging``
- Set the GIT_PYTHON_TRACE environment variable print each invocation
+ Set the GIT_PYTHON_TRACE environment variable print each invocation
of the command to stdout.
Set its value to 'full' to see details about the returned values.
"""
@@ -63,7 +63,7 @@ class Git(LazyMixin):
class AutoInterrupt(object):
- """Kill/Interrupt the stored process instance once this instance goes out of scope. It is
+ """Kill/Interrupt the stored process instance once this instance goes out of scope. It is
used to prevent processes piling up in case iterators stop reading.
Besides all attributes are wired through to the contained process object.
@@ -83,7 +83,7 @@ class Git(LazyMixin):
if self.proc.poll() is not None:
return
- # can be that nothing really exists anymore ...
+ # can be that nothing really exists anymore ...
if os is None:
return
@@ -94,34 +94,34 @@ class Git(LazyMixin):
except OSError:
pass # ignore error when process already died
except AttributeError:
- # try windows
- # for some reason, providing None for stdout/stderr still prints something. This is why
- # we simply use the shell and redirect to nul. Its slower than CreateProcess, question
+ # try windows
+ # for some reason, providing None for stdout/stderr still prints something. This is why
+ # we simply use the shell and redirect to nul. Its slower than CreateProcess, question
# is whether we really want to see all these messages. Its annoying no matter what.
call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(self.proc.pid)), shell=True)
- # END exception handling
+ # END exception handling
def __getattr__(self, attr):
return getattr(self.proc, attr)
def wait(self):
- """Wait for the process and return its status code.
+ """Wait for the process and return its status code.
:raise GitCommandError: if the return status is not 0"""
status = self.proc.wait()
if status != 0:
raise GitCommandError(self.args, status, self.proc.stderr.read())
- # END status handling
+ # END status handling
return status
# END auto interrupt
class CatFileContentStream(object):
- """Object representing a sized read-only stream returning the contents of
+ """Object representing a sized read-only stream returning the contents of
an object.
- It behaves like a stream, but counts the data read and simulates an empty
+ It behaves like a stream, but counts the data read and simulates an empty
stream once our sized content region is empty.
- If not all data is read to the end of the objects's lifetime, we read the
+ If not all data is read to the end of the objects's lifetime, we read the
rest to assure the underlying stream continues to work"""
__slots__ = ('_stream', '_nbr', '_size')
@@ -131,7 +131,7 @@ class Git(LazyMixin):
self._size = size
self._nbr = 0 # num bytes read
- # special case: if the object is empty, has null bytes, get the
+ # special case: if the object is empty, has null bytes, get the
# final newline right away.
if size == 0:
stream.read(1)
@@ -220,9 +220,9 @@ class Git(LazyMixin):
"""Initialize this instance with:
:param working_dir:
- Git directory we should work in. If None, we always work in the current
+ Git directory we should work in. If None, we always work in the current
directory as returned by os.getcwd().
- It is meant to be the working tree directory if available, or the
+ It is meant to be the working tree directory if available, or the
.git directory in case of bare repositories."""
super(Git, self).__init__()
self._working_dir = working_dir
@@ -233,7 +233,7 @@ class Git(LazyMixin):
self.cat_file_all = None
def __getattr__(self, name):
- """A convenience method as it allows to call the command as if it was
+ """A convenience method as it allows to call the command as if it was
an object.
:return: Callable object that will execute call _call_process with your arguments."""
if name[0] == '_':
@@ -267,8 +267,8 @@ class Git(LazyMixin):
with_keep_cwd=False,
with_extended_output=False,
with_exceptions=True,
- as_process=False,
- output_stream=None,
+ as_process=False,
+ output_stream=None,
**subprocess_kwargs
):
"""Handles executing the command on the shell and consumes and returns
@@ -294,26 +294,26 @@ class Git(LazyMixin):
Whether to raise an exception when git returns a non-zero status.
:param as_process:
- Whether to return the created process instance directly from which
- streams can be read on demand. This will render with_extended_output and
- with_exceptions ineffective - the caller will have
+ Whether to return the created process instance directly from which
+ streams can be read on demand. This will render with_extended_output and
+ with_exceptions ineffective - the caller will have
to deal with the details himself.
It is important to note that the process will be placed into an AutoInterrupt
- wrapper that will interrupt the process once it goes out of scope. If you
- use the command in iterators, you should pass the whole process instance
+ wrapper that will interrupt the process once it goes out of scope. If you
+ use the command in iterators, you should pass the whole process instance
instead of a single stream.
:param output_stream:
- If set to a file-like object, data produced by the git command will be
+ If set to a file-like object, data produced by the git command will be
output to the given stream directly.
This feature only has any effect if as_process is False. Processes will
always be created with a pipe due to issues with subprocess.
- This merely is a workaround as data will be copied from the
+ This merely is a workaround as data will be copied from the
output pipe to the given output stream directly.
:param subprocess_kwargs:
- Keyword arguments to be passed to subprocess.Popen. Please note that
- some of the valid kwargs are already set by this method, the ones you
+ Keyword arguments to be passed to subprocess.Popen. Please note that
+ some of the valid kwargs are already set by this method, the ones you
specify may not be the same ones.
:return:
@@ -330,7 +330,7 @@ class Git(LazyMixin):
:raise GitCommandError:
:note:
- If you add additional keyword arguments to the signature of this method,
+ If you add additional keyword arguments to the signature of this method,
you must update the execute_kwargs tuple housed in this module."""
if self.GIT_PYTHON_TRACE and not self.GIT_PYTHON_TRACE == 'full':
print ' '.join(command)
@@ -360,7 +360,7 @@ class Git(LazyMixin):
stderr_value = ''
try:
if output_stream is None:
- stdout_value, stderr_value = proc.communicate()
+ stdout_value, stderr_value = proc.communicate()
# strip trailing "\n"
if stdout_value.endswith("\n"):
stdout_value = stdout_value[:-1]
@@ -434,7 +434,7 @@ class Git(LazyMixin):
outlist.extend(cls.__unpack_args(arg))
elif isinstance(arg_list, unicode):
outlist.append(arg_list.encode('utf-8'))
- # END recursion
+ # END recursion
else:
outlist.append(str(arg))
# END for each arg
@@ -523,7 +523,7 @@ class Git(LazyMixin):
finally:
import warnings
msg = "WARNING: Automatically switched to use git.cmd as git executable, which reduces performance by ~70%."
- msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var
+ msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var
warnings.warn(msg)
#END print of warning
#END catch first failure
@@ -541,7 +541,7 @@ class Git(LazyMixin):
:return: (hex_sha, type_string, size_as_int)
- :raise ValueError: if the header contains indication for an error due to
+ :raise ValueError: if the header contains indication for an error due to
incorrect input sha"""
tokens = header_line.split()
if len(tokens) != 3:
@@ -553,7 +553,7 @@ class Git(LazyMixin):
# END error handling
if len(tokens[0]) != 40:
- raise ValueError("Failed to parse header: %r" % header_line)
+ raise ValueError("Failed to parse header: %r" % header_line)
return (tokens[0], tokens[1], int(tokens[2]))
def __prepare_ref(self, ref):
@@ -581,11 +581,11 @@ class Git(LazyMixin):
return self._parse_object_header(cmd.stdout.readline())
def get_object_header(self, ref):
- """ Use this method to quickly examine the type and size of the object behind
- the given ref.
+ """ Use this method to quickly examine the type and size of the object behind
+ the given ref.
- :note: The method will only suffer from the costs of command invocation
- once and reuses the command in subsequent calls.
+ :note: The method will only suffer from the costs of command invocation
+ once and reuses the command in subsequent calls.
:return: (hexsha, type_string, size_as_int)"""
cmd = self.__get_persistent_cmd("cat_file_header", "cat_file", batch_check=True)
diff --git a/git/config.py b/git/config.py
index b7b36e9e..15aa76f0 100644
--- a/git/config.py
+++ b/git/config.py
@@ -74,12 +74,12 @@ def set_dirty_and_flush_changes(non_const_func):
class SectionConstraint(object):
- """Constrains a ConfigParser to only option commands which are constrained to
+ """Constrains a ConfigParser to only option commands which are constrained to
always use the section we have been initialized with.
It supports all ConfigParser methods that operate on an option"""
__slots__ = ("_config", "_section_name")
- _valid_attrs_ = ("get_value", "set_value", "get", "set", "getint", "getfloat", "getboolean", "has_option",
+ _valid_attrs_ = ("get_value", "set_value", "get", "set", "getint", "getfloat", "getboolean", "has_option",
"remove_section", "remove_option", "options")
def __init__(self, config, section):
@@ -92,7 +92,7 @@ class SectionConstraint(object):
return super(SectionConstraint, self).__getattribute__(attr)
def _call_config(self, method, *args, **kwargs):
- """Call the configuration at the given method which must take a section name
+ """Call the configuration at the given method which must take a section name
as first argument"""
return getattr(self._config, method)(self._section_name, *args, **kwargs)
@@ -109,10 +109,10 @@ class GitConfigParser(cp.RawConfigParser, object):
This variation behaves much like the git.config command such that the configuration
will be read on demand based on the filepath given during initialization.
- The changes will automatically be written once the instance goes out of scope, but
+ The changes will automatically be written once the instance goes out of scope, but
can be triggered manually as well.
- The configuration file will be locked if you intend to change values preventing other
+ The configuration file will be locked if you intend to change values preventing other
instances to write concurrently.
:note:
@@ -127,7 +127,7 @@ class GitConfigParser(cp.RawConfigParser, object):
t_lock = LockFile
re_comment = re.compile('^\s*[#;]')
- #} END configuration
+ #} END configuration
OPTCRE = re.compile(
r'\s*(?P<option>[^:=\s][^:=]*)' # very permissive, incuding leading whitespace
@@ -143,7 +143,7 @@ class GitConfigParser(cp.RawConfigParser, object):
__slots__ = ("_sections", "_defaults", "_file_or_files", "_read_only", "_is_initialized", '_lock')
def __init__(self, file_or_files, read_only=True):
- """Initialize a configuration reader to read the given file_or_files and to
+ """Initialize a configuration reader to read the given file_or_files and to
possibly allow changes to it by setting read_only False
:param file_or_files:
@@ -153,8 +153,8 @@ class GitConfigParser(cp.RawConfigParser, object):
If True, the ConfigParser may only read the data , but not change it.
If False, only a single file path or file object may be given."""
super(GitConfigParser, self).__init__()
- # initialize base with ordered dictionaries to be sure we write the same
- # file back
+ # initialize base with ordered dictionaries to be sure we write the same
+ # file back
self._sections = OrderedDict()
self._defaults = OrderedDict()
@@ -200,7 +200,7 @@ class GitConfigParser(cp.RawConfigParser, object):
"""A direct copy of the py2.4 version of the super class's _read method
to assure it uses ordered dicts. Had to change one line to make it work.
- Future versions have this fixed, but in fact its quite embarassing for the
+ Future versions have this fixed, but in fact its quite embarassing for the
guys not to have done it right in the first place !
Removed big comments to make it more compact.
@@ -257,16 +257,16 @@ class GitConfigParser(cp.RawConfigParser, object):
if not e:
e = cp.ParsingError(fpname)
e.append(lineno, repr(line))
- # END
- # END ?
+ # END
+ # END ?
# END ?
- # END while reading
+ # END while reading
# if any parsing errors occurred, raise an exception
if e:
raise e
def read(self):
- """Reads the data stored in the files we have been initialized with. It will
+ """Reads the data stored in the files we have been initialized with. It will
ignore files that cannot be read, possibly leaving an empty configuration
:return: Nothing
@@ -300,7 +300,7 @@ class GitConfigParser(cp.RawConfigParser, object):
self._is_initialized = True
def _write(self, fp):
- """Write an .ini-format representation of the configuration state in
+ """Write an .ini-format representation of the configuration state in
git compatible format"""
def write_section(name, section_dict):
fp.write("[%s]\n" % name)
@@ -308,7 +308,7 @@ class GitConfigParser(cp.RawConfigParser, object):
if key != "__name__":
fp.write("\t%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
# END if key is not __name__
- # END section writing
+ # END section writing
if self._defaults:
write_section(cp.DEFAULTSECT, self._defaults)
@@ -318,7 +318,7 @@ class GitConfigParser(cp.RawConfigParser, object):
def write(self):
"""Write changes to our file, if there are changes at all
- :raise IOError: if this is a read-only writer instance or if we could not obtain
+ :raise IOError: if this is a read-only writer instance or if we could not obtain
a file lock"""
self._assure_writable("write")
@@ -338,7 +338,7 @@ class GitConfigParser(cp.RawConfigParser, object):
# make sure we do not overwrite into an existing file
if hasattr(fp, 'truncate'):
fp.truncate()
- #END
+ #END
# END handle stream or file
# WRITE DATA
@@ -349,7 +349,7 @@ class GitConfigParser(cp.RawConfigParser, object):
fp.close()
# END data writing
- # we do not release the lock - it will be done automatically once the
+ # we do not release the lock - it will be done automatically once the
# instance vanishes
def _assure_writable(self, method_name):
@@ -371,7 +371,7 @@ class GitConfigParser(cp.RawConfigParser, object):
def get_value(self, section, option, default=None):
"""
:param default:
- If not None, the given default value will be returned in case
+ If not None, the given default value will be returned in case
the option did not exist
:return: a properly typed value, either int, float or string
@@ -399,7 +399,7 @@ class GitConfigParser(cp.RawConfigParser, object):
# END for each numeric type
# try boolean values as git uses them
- vl = valuestr.lower()
+ vl = valuestr.lower()
if vl == 'false':
return False
if vl == 'true':
@@ -414,13 +414,13 @@ class GitConfigParser(cp.RawConfigParser, object):
@set_dirty_and_flush_changes
def set_value(self, section, option, value):
"""Sets the given option in section to the given value.
- It will create the section if required, and will not throw as opposed to the default
+ It will create the section if required, and will not throw as opposed to the default
ConfigParser 'set' method.
:param section: Name of the section in which the option resides or should reside
:param option: Name of the options whose value to set
- :param value: Value to set the option to. It must be a string or convertible
+ :param value: Value to set the option to. It must be a string or convertible
to a string"""
if not self.has_section(section):
self.add_section(section)
diff --git a/git/db.py b/git/db.py
index 5bb45a5e..2cafd766 100644
--- a/git/db.py
+++ b/git/db.py
@@ -1,6 +1,6 @@
"""Module with our own gitdb implementation - it uses the git command"""
from exc import (
- GitCommandError,
+ GitCommandError,
BadObject
)
@@ -10,7 +10,7 @@ from gitdb.base import (
)
from gitdb.util import (
- bin_to_hex,
+ bin_to_hex,
hex_to_bin
)
from gitdb.db import GitDB
@@ -24,11 +24,11 @@ __all__ = ('GitCmdObjectDB', 'GitDB')
class GitCmdObjectDB(LooseObjectDB):
- """A database representing the default git object store, which includes loose
+ """A database representing the default git object store, which includes loose
objects, pack files and an alternates file
It will create objects only in the loose object database.
- :note: for now, we use the git command to do all the lookup, just until he
+ :note: for now, we use the git command to do all the lookup, just until he
have packs and the other implementations
"""
@@ -52,7 +52,7 @@ class GitCmdObjectDB(LooseObjectDB):
""":return: Full binary 20 byte sha from the given partial hexsha
:raise AmbiguousObjectName:
:raise BadObject:
- :note: currently we only raise BadObject as git does not communicate
+ :note: currently we only raise BadObject as git does not communicate
AmbiguousObjects separately"""
try:
hexsha, typename, size = self._git.get_object_header(partial_hexsha)
diff --git a/git/diff.py b/git/diff.py
index 009158fc..d8424e71 100644
--- a/git/diff.py
+++ b/git/diff.py
@@ -6,7 +6,7 @@
import re
from objects.blob import Blob
-from objects.util import mode_str_to_int
+from objects.util import mode_str_to_int
from exc import GitCommandError
from gitdb.util import hex_to_bin
@@ -19,14 +19,14 @@ class Diffable(object):
"""Common interface for all object that can be diffed against another object of compatible type.
- :note:
- Subclasses require a repo member as it is the case for Object instances, for practical
+ :note:
+ Subclasses require a repo member as it is the case for Object instances, for practical
reasons we do not derive from Object."""
__slots__ = tuple()
# standin indicating you want to diff against the index
class Index(object):
- pass
+ pass
def _process_diff_args(self, args):
"""
@@ -37,11 +37,11 @@ class Diffable(object):
return args
def diff(self, other=Index, paths=None, create_patch=False, **kwargs):
- """Creates diffs between two items being trees, trees and index or an
+ """Creates diffs between two items being trees, trees and index or an
index and the working tree.
:param other:
- Is the item to compare us with.
+ Is the item to compare us with.
If None, we will be compared to the working tree.
If Treeish, it will be compared against the respective tree
If Index ( type ), it will be compared against the index.
@@ -58,7 +58,7 @@ class Diffable(object):
and diffed.
:param kwargs:
- Additional arguments passed to git-diff, such as
+ Additional arguments passed to git-diff, such as
R=True to swap both sides of the diff.
:return: git.DiffIndex
@@ -66,7 +66,7 @@ class Diffable(object):
:note:
Rename detection will only work if create_patch is True.
- On a bare repository, 'other' needs to be provided as Index or as
+ On a bare repository, 'other' needs to be provided as Index or as
as Tree/Commit, or a git command error will occour"""
args = list()
args.append("--abbrev=40") # we need full shas
@@ -78,7 +78,7 @@ class Diffable(object):
else:
args.append("--raw")
- # in any way, assure we don't see colored output,
+ # in any way, assure we don't see colored output,
# fixes https://github.com/gitpython-developers/GitPython/issues/172
args.append('--no-color')
@@ -112,7 +112,7 @@ class Diffable(object):
class DiffIndex(list):
- """Implements an Index for diffs, allowing a list of Diffs to be queried by
+ """Implements an Index for diffs, allowing a list of Diffs to be queried by
the diff properties.
The class improves the diff handling convenience"""
@@ -154,10 +154,10 @@ class Diff(object):
"""A Diff contains diff information between two Trees.
- It contains two sides a and b of the diff, members are prefixed with
+ It contains two sides a and b of the diff, members are prefixed with
"a" and "b" respectively to inidcate that.
- Diffs keep information about the changed blob objects, the file mode, renames,
+ Diffs keep information about the changed blob objects, the file mode, renames,
deletions and new files.
There are a few cases where None has to be expected as member variable value:
@@ -176,8 +176,8 @@ class Diff(object):
When comparing to working trees, the working tree blob will have a null hexsha
as a corresponding object does not yet exist. The mode will be null as well.
- But the path will be available though.
- If it is listed in a diff the working tree version of the file must
+ But the path will be available though.
+ If it is listed in a diff the working tree version of the file must
be different to the version in the index or tree, and hence has been modified."""
# precompiled regex
@@ -198,7 +198,7 @@ class Diff(object):
NULL_HEX_SHA = "0" * 40
NULL_BIN_SHA = "\0" * 20
- __slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file",
+ __slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file",
"rename_from", "rename_to", "diff")
def __init__(self, repo, a_path, b_path, a_blob_id, b_blob_id, a_mode,
@@ -248,7 +248,7 @@ class Diff(object):
h = "%s"
if self.a_blob:
h %= self.a_blob.path
- elif self.b_blob:
+ elif self.b_blob:
h %= self.b_blob.path
msg = ''
@@ -291,7 +291,7 @@ class Diff(object):
@classmethod
def _index_from_patch_format(cls, repo, stream):
"""Create a new DiffIndex from the given text which must be in patch format
- :param repo: is the repository we are operating on - it is required
+ :param repo: is the repository we are operating on - it is required
:param stream: result of 'git diff' as a stream (supporting file protocol)
:return: git.DiffIndex """
# for now, we have to bake the stream
@@ -316,11 +316,11 @@ class Diff(object):
@classmethod
def _index_from_raw_format(cls, repo, stream):
"""Create a new DiffIndex from the given stream which must be in raw format.
- :note:
- This format is inherently incapable of detecting renames, hence we only
+ :note:
+ This format is inherently incapable of detecting renames, hence we only
modify, delete and add files
:return: git.DiffIndex"""
- # handles
+ # handles
# :100644 100644 6870991011cc8d9853a7a8a6f02061512c6a8190 37c5e30c879213e9ae83b21e9d11e55fc20c54b7 M .gitignore
index = DiffIndex()
for line in stream:
diff --git a/git/exc.py b/git/exc.py
index feae0954..f1fcf9b3 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -68,5 +68,5 @@ class CacheError(Exception):
class UnmergedEntriesError(CacheError):
- """Thrown if an operation cannot proceed as there are still unmerged
+ """Thrown if an operation cannot proceed as there are still unmerged
entries in the cache"""
diff --git a/git/index/base.py b/git/index/base.py
index 870b2393..f11f4492 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -13,13 +13,13 @@ from cStringIO import StringIO
from stat import S_ISLNK
from typ import (
- BaseIndexEntry,
- IndexEntry,
+ BaseIndexEntry,
+ IndexEntry,
)
from util import (
TemporaryFileSwap,
- post_clear_cache,
+ post_clear_cache,
default_index,
git_working_dir
)
@@ -35,18 +35,18 @@ from git.exc import (
from git.objects import (
Blob,
Submodule,
- Tree,
- Object,
+ Tree,
+ Object,
Commit,
)
from git.objects.util import Serializable
from git.util import (
- IndexFileSHA1Writer,
- LazyMixin,
- LockedFD,
- join_path_native,
+ IndexFileSHA1Writer,
+ LazyMixin,
+ LockedFD,
+ join_path_native,
file_contents_ro,
to_native_path_linux,
to_native_path
@@ -58,7 +58,7 @@ from fun import (
read_cache,
aggressive_tree_merge,
write_tree_from_cache,
- stat_mode_to_index_mode,
+ stat_mode_to_index_mode,
S_IFGITLINK
)
@@ -121,12 +121,12 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
return
# END exception handling
- # Here it comes: on windows in python 2.5, memory maps aren't closed properly
- # Hence we are in trouble if we try to delete a file that is memory mapped,
+ # Here it comes: on windows in python 2.5, memory maps aren't closed properly
+ # Hence we are in trouble if we try to delete a file that is memory mapped,
# which happens during read-tree.
# In this case, we will just read the memory in directly.
# Its insanely bad ... I am disappointed !
- allow_mmap = (os.name != 'nt' or sys.version_info[1] > 5)
+ allow_mmap = (os.name != 'nt' or sys.version_info[1] > 5)
stream = file_contents_ro(fd, stream=True, allow_mmap=allow_mmap)
try:
@@ -155,7 +155,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
pass
# END exception handling
- #{ Serializable Interface
+ #{ Serializable Interface
def _deserialize(self, stream):
"""Initialize this instance with index values read from the given stream"""
@@ -172,7 +172,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
entries = self._entries_sorted()
write_cache(entries,
stream,
- (ignore_tree_extension_data and None) or self._extension_data)
+ (ignore_tree_extension_data and None) or self._extension_data)
return self
#} END serializable interface
@@ -198,7 +198,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:return: self"""
# make sure we have our entries read before getting a write lock
- # else it would be done when streaming. This can happen
+ # else it would be done when streaming. This can happen
# if one doesn't change the index, but writes it right away
self.entries
lfd = LockedFD(file_path or self._file_path)
@@ -257,17 +257,17 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:param repo: The repository treeish are located in.
:param tree_sha:
- 20 byte or 40 byte tree sha or tree objects
+ 20 byte or 40 byte tree sha or tree objects
:return:
- New IndexFile instance. Its path will be undefined.
- If you intend to write such a merged Index, supply an alternate file_path
+ New IndexFile instance. Its path will be undefined.
+ If you intend to write such a merged Index, supply an alternate file_path
to its 'write' method."""
base_entries = aggressive_tree_merge(repo.odb, [to_bin_sha(str(t)) for t in tree_sha])
inst = cls(repo)
# convert to entries dict
- entries = dict(izip(((e.path, e.stage) for e in base_entries),
+ entries = dict(izip(((e.path, e.stage) for e in base_entries),
(IndexEntry.from_base(e) for e in base_entries)))
inst.entries = entries
@@ -379,7 +379,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# END path exception handling
# END for each path
- def _write_path_to_stdin(self, proc, filepath, item, fmakeexc, fprogress,
+ def _write_path_to_stdin(self, proc, filepath, item, fmakeexc, fprogress,
read_from_stdout=True):
"""Write path to proc.stdin and make sure it processes the item, including progress.
@@ -418,7 +418,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
iterator. A default filter, the BlobFilter, allows you to yield blobs
only if they match a given list of paths. """
for entry in self.entries.itervalues():
- # TODO: is it necessary to convert the mode ? We did that when adding
+ # TODO: is it necessary to convert the mode ? We did that when adding
# it to the index, right ?
mode = stat_mode_to_index_mode(entry.mode)
blob = entry.to_blob(self.repo)
@@ -504,7 +504,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
object database and return it.
:return: Tree object representing this index
- :note: The tree will be written even if one or more objects the tree refers to
+ :note: The tree will be written even if one or more objects the tree refers to
does not yet exist in the object database. This could happen if you added
Entries to the index directly.
:raise ValueError: if there are no entries in the cache
@@ -560,10 +560,10 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
return (paths, entries)
@git_working_dir
- def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=None,
+ def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=None,
write=True):
"""Add files from the working tree, specific blobs or BaseIndexEntries
- to the index.
+ to the index.
:param items:
Multiple types of items are supported, types can be mixed within one call.
@@ -591,7 +591,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
must be a path relative to our repository.
If their sha is null ( 40*0 ), their path must exist in the file system
- relative to the git repository as an object will be created from
+ relative to the git repository as an object will be created from
the data at the path.
The handling now very much equals the way string paths are processed, except that
the mode you have set will be kept. This allows you to create symlinks
@@ -654,8 +654,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
for path in paths:
abspath = os.path.abspath(path)
gitrelative_path = abspath[len(self.repo.working_tree_dir) + 1:]
- blob = Blob(self.repo, Blob.NULL_BIN_SHA,
- stat_mode_to_index_mode(os.stat(abspath).st_mode),
+ blob = Blob(self.repo, Blob.NULL_BIN_SHA,
+ stat_mode_to_index_mode(os.stat(abspath).st_mode),
to_native_path_linux(gitrelative_path))
entries.append(BaseIndexEntry.from_blob(blob))
# END for each path
@@ -674,7 +674,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
fprogress(filepath, False, filepath)
istream = self.repo.odb.store(IStream(Blob.type, st.st_size, stream))
fprogress(filepath, True, filepath)
- return BaseIndexEntry((stat_mode_to_index_mode(st.st_mode),
+ return BaseIndexEntry((stat_mode_to_index_mode(st.st_mode),
istream.binsha, 0, to_native_path_linux(filepath)))
# END utility method
@@ -929,10 +929,10 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
Raise GitCommandError if error lines could not be parsed - this truly is
an exceptional state
- .. note:: The checkout is limited to checking out the files in the
- index. Files which are not in the index anymore and exist in
+ .. note:: The checkout is limited to checking out the files in the
+ index. Files which are not in the index anymore and exist in
the working tree will not be deleted. This behaviour is fundamentally
- different to *head.checkout*, i.e. if you want git-checkout like behaviour,
+ different to *head.checkout*, i.e. if you want git-checkout like behaviour,
use head.checkout instead of index.checkout.
"""
args = ["--index"]
@@ -998,7 +998,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
paths = [paths]
# make sure we have our entries loaded before we start checkout_index
- # which will hold a lock on it. We try to get the lock as well during
+ # which will hold a lock on it. We try to get the lock as well during
# our entries initialization
self.entries
@@ -1023,7 +1023,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
for entry in self.entries.itervalues():
if entry.path.startswith(dir):
p = entry.path
- self._write_path_to_stdin(proc, p, p, make_exc,
+ self._write_path_to_stdin(proc, p, p, make_exc,
fprogress, read_from_stdout=False)
checked_out_files.append(p)
path_is_directory = True
@@ -1032,7 +1032,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# END path exception handlnig
if not path_is_directory:
- self._write_path_to_stdin(proc, co_path, path, make_exc,
+ self._write_path_to_stdin(proc, co_path, path, make_exc,
fprogress, read_from_stdout=False)
checked_out_files.append(co_path)
# END path is a file
@@ -1066,7 +1066,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:param paths: if given as an iterable of absolute or repository-relative paths,
only these will be reset to their state at the given commit'ish.
- The paths need to exist at the commit, otherwise an exception will be
+ The paths need to exist at the commit, otherwise an exception will be
raised.
:param kwargs:
diff --git a/git/index/fun.py b/git/index/fun.py
index aea7e50f..cf55064e 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -26,20 +26,20 @@ from git.objects.fun import (
from typ import (
BaseIndexEntry,
IndexEntry,
- CE_NAMEMASK,
+ CE_NAMEMASK,
CE_STAGESHIFT
)
CE_NAMEMASK_INV = ~CE_NAMEMASK
from util import (
- pack,
+ pack,
unpack
)
from gitdb.base import IStream
from gitdb.typ import str_tree_type
-__all__ = ('write_cache', 'read_cache', 'write_tree_from_cache', 'entry_key',
+__all__ = ('write_cache', 'read_cache', 'write_tree_from_cache', 'entry_key',
'stat_mode_to_index_mode', 'S_IFGITLINK')
@@ -178,7 +178,7 @@ def write_tree_from_cache(entries, odb, sl, si=0):
:param odb: object database to store the trees in
:param si: start index at which we should start creating subtrees
:param sl: slice indicating the range we should process on the entries list
- :return: tuple(binsha, list(tree_entry, ...)) a tuple of a sha and a list of
+ :return: tuple(binsha, list(tree_entry, ...)) a tuple of a sha and a list of
tree entries being a tuple of hexsha, mode, name"""
tree_items = list()
tree_items_append = tree_items.append
@@ -214,7 +214,7 @@ def write_tree_from_cache(entries, odb, sl, si=0):
# skip ahead
ci = xi
- # END handle bounds
+ # END handle bounds
# END for each entry
# finally create the tree
@@ -233,8 +233,8 @@ def _tree_entry_to_baseindexentry(tree_entry, stage):
def aggressive_tree_merge(odb, tree_shas):
"""
:return: list of BaseIndexEntries representing the aggressive merge of the given
- trees. All valid entries are on stage 0, whereas the conflicting ones are left
- on stage 1, 2 or 3, whereas stage 1 corresponds to the common ancestor tree,
+ trees. All valid entries are on stage 0, whereas the conflicting ones are left
+ on stage 1, 2 or 3, whereas stage 1 corresponds to the common ancestor tree,
2 to our tree and 3 to 'their' tree.
:param tree_shas: 1, 2 or 3 trees as identified by their binary 20 byte shas
If 1 or two, the entries will effectively correspond to the last given tree
@@ -249,7 +249,7 @@ def aggressive_tree_merge(odb, tree_shas):
out_append(_tree_entry_to_baseindexentry(entry, 0))
# END for each entry
return out
- # END handle single tree
+ # END handle single tree
if len(tree_shas) > 3:
raise ValueError("Cannot handle %i trees at once" % len(tree_shas))
@@ -277,11 +277,11 @@ def aggressive_tree_merge(odb, tree_shas):
# either nobody changed it, or they did. In either
# case, use theirs
out_append(_tree_entry_to_baseindexentry(theirs, 0))
- # END handle modification
+ # END handle modification
else:
if ours[0] != base[0] or ours[1] != base[1]:
- # they deleted it, we changed it, conflict
+ # they deleted it, we changed it, conflict
out_append(_tree_entry_to_baseindexentry(base, 1))
out_append(_tree_entry_to_baseindexentry(ours, 2))
# else:
diff --git a/git/index/typ.py b/git/index/typ.py
index 8cc076a5..4a6f6a81 100644
--- a/git/index/typ.py
+++ b/git/index/typ.py
@@ -1,7 +1,7 @@
"""Module with additional types used by the index"""
from util import (
- pack,
+ pack,
unpack
)
@@ -108,7 +108,7 @@ class BaseIndexEntry(tuple):
def to_blob(self, repo):
""":return: Blob using the information of this index entry"""
- return Blob(repo, self.binsha, self.mode, self.path)
+ return Blob(repo, self.binsha, self.mode, self.path)
class IndexEntry(BaseIndexEntry):
@@ -159,7 +159,7 @@ class IndexEntry(BaseIndexEntry):
@classmethod
def from_base(cls, base):
- """
+ """
:return:
Minimal entry as created from the given BaseIndexEntry instance.
Missing values will be set to null-like values
diff --git a/git/index/util.py b/git/index/util.py
index 498c0513..064a22ce 100644
--- a/git/index/util.py
+++ b/git/index/util.py
@@ -5,7 +5,7 @@ import os
__all__ = ('TemporaryFileSwap', 'post_clear_cache', 'default_index', 'git_working_dir')
-#{ Aliases
+#{ Aliases
pack = struct.pack
unpack = struct.unpack
@@ -35,7 +35,7 @@ class TemporaryFileSwap(object):
# END temp file exists
-#{ Decorators
+#{ Decorators
def post_clear_cache(func):
"""Decorator for functions that alter the index using the git command. This would
@@ -73,7 +73,7 @@ def default_index(func):
def git_working_dir(func):
- """Decorator which changes the current working dir to the one of the git
+ """Decorator which changes the current working dir to the one of the git
repository in order to assure relative paths are handled correctly"""
def set_git_working_dir(self, *args, **kwargs):
diff --git a/git/objects/__init__.py b/git/objects/__init__.py
index 5708ac0b..088dd699 100644
--- a/git/objects/__init__.py
+++ b/git/objects/__init__.py
@@ -3,7 +3,7 @@ Import all submodules main classes into the package space
"""
import inspect
from base import *
-# Fix import dependency - add IndexObject to the util module, so that it can be
+# Fix import dependency - add IndexObject to the util module, so that it can be
# imported by the submodule.base
import submodule.util
submodule.util.IndexObject = IndexObject
diff --git a/git/objects/base.py b/git/objects/base.py
index d7c92d8a..0fcd25d6 100644
--- a/git/objects/base.py
+++ b/git/objects/base.py
@@ -29,7 +29,7 @@ class Object(LazyMixin):
type = None # to be set by subclass
def __init__(self, repo, binsha):
- """Initialize an object by identifying it by its binary sha.
+ """Initialize an object by identifying it by its binary sha.
All keyword arguments will be set on demand if None.
:param repo: repository this object is located in
@@ -43,8 +43,8 @@ class Object(LazyMixin):
@classmethod
def new(cls, repo, id):
"""
- :return: New Object instance of a type appropriate to the object type behind
- id. The id of the newly created object will be a binsha even though
+ :return: New Object instance of a type appropriate to the object type behind
+ id. The id of the newly created object will be a binsha even though
the input id may have been a Reference or Rev-Spec
:param id: reference, rev-spec, or hexsha
@@ -56,7 +56,7 @@ class Object(LazyMixin):
@classmethod
def new_from_sha(cls, repo, sha1):
"""
- :return: new object instance of a type appropriate to represent the given
+ :return: new object instance of a type appropriate to represent the given
binary sha1
:param sha1: 20 byte binary sha1"""
if sha1 == cls.NULL_BIN_SHA:
@@ -66,7 +66,7 @@ class Object(LazyMixin):
oinfo = repo.odb.info(sha1)
inst = get_object_type_by_name(oinfo.type)(repo, oinfo.binsha)
inst.size = oinfo.size
- return inst
+ return inst
def _set_cache_(self, attr):
"""Retrieve object information"""
@@ -150,7 +150,7 @@ class IndexObject(Object):
def __hash__(self):
""":return:
- Hash of our path as index items are uniquely identifyable by path, not
+ Hash of our path as index items are uniquely identifyable by path, not
by their data !"""
return hash(self.path)
@@ -171,7 +171,7 @@ class IndexObject(Object):
def abspath(self):
"""
:return:
- Absolute path to this index object in the file system ( as opposed to the
+ Absolute path to this index object in the file system ( as opposed to the
.path field which is a path relative to the git repository ).
The returned path will be native to the system and contains '\' on windows. """
diff --git a/git/objects/commit.py b/git/objects/commit.py
index 14cf5bbb..d778f2d7 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -27,7 +27,7 @@ from util import (
parse_actor_and_date
)
from time import (
- time,
+ time,
altzone
)
import os
@@ -40,7 +40,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
"""Wraps a git Commit object.
- This class will act lazily on some of its attributes and will query the
+ This class will act lazily on some of its attributes and will query the
value on demand only if it involves calling the git binary."""
# ENVIRONMENT VARIABLES
@@ -54,7 +54,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# INVARIANTS
default_encoding = "UTF-8"
- # object configuration
+ # object configuration
type = "commit"
__slots__ = ("tree",
"author", "authored_date", "author_tz_offset",
@@ -68,21 +68,21 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
"""Instantiate a new Commit. All keyword arguments taking None as default will
be implicitly set on first query.
:param binsha: 20 byte sha1
- :param parents: tuple( Commit, ... )
+ :param parents: tuple( Commit, ... )
is a tuple of commit ids or actual Commits
:param tree: Tree
Tree object
:param author: Actor
is the author string ( will be implicitly converted into an Actor object )
:param authored_date: int_seconds_since_epoch
- is the authored DateTime - use time.gmtime() to convert it into a
+ is the authored DateTime - use time.gmtime() to convert it into a
different format
:param author_tz_offset: int_seconds_west_of_utc
is the timezone that the authored_date is in
:param committer: Actor
is the committer string
:param committed_date: int_seconds_since_epoch
- is the committed DateTime - use time.gmtime() to convert it into a
+ is the committed DateTime - use time.gmtime() to convert it into a
different format
:param committer_tz_offset: int_seconds_west_of_utc
is the timezone that the authored_date is in
@@ -91,12 +91,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
:param encoding: string
encoding of the message, defaults to UTF-8
:param parents:
- List or tuple of Commit objects which are our parent(s) in the commit
+ List or tuple of Commit objects which are our parent(s) in the commit
dependency graph
:return: git.Commit
- :note: Timezone information is in the same format and in the same sign
- as what time.altzone returns. The sign is inverted compared to git's
+ :note: Timezone information is in the same format and in the same sign
+ as what time.altzone returns. The sign is inverted compared to git's
UTC timezone."""
super(Commit, self).__init__(repo, binsha)
if tree is not None:
@@ -145,7 +145,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
"""Count the number of commits reachable from this commit
:param paths:
- is an optinal path or a list of paths restricting the return value
+ is an optinal path or a list of paths restricting the return value
to commits actually containing the paths
:param kwargs:
@@ -174,7 +174,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
:param repo: is the Repo
:param rev: revision specifier, see git-rev-parse for viable options
:param paths:
- is an optinal path or list of paths, if set only Commits that include the path
+ is an optinal path or list of paths, if set only Commits that include the path
or paths will be considered
:param kwargs:
optional keyword arguments to git rev-list where
@@ -197,13 +197,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
"""Iterate _all_ parents of this commit.
:param paths:
- Optional path or list of paths limiting the Commits to those that
+ Optional path or list of paths limiting the Commits to those that
contain at least one of the paths
:param kwargs: All arguments allowed by git-rev-list
:return: Iterator yielding Commit objects which are parents of self """
# skip ourselves
skip = kwargs.get("skip", 1)
- if skip == 0: # skip ourselves
+ if skip == 0: # skip ourselves
skip = 1
kwargs['skip'] = skip
@@ -211,7 +211,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
@property
def stats(self):
- """Create a git stat from changes between this commit and its first parent
+ """Create a git stat from changes between this commit and its first parent
or from all changes done if this is the very first commit.
:return: git.Stats"""
@@ -261,27 +261,27 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
"""Commit the given tree, creating a commit object.
- :param repo: Repo object the commit should be part of
- :param tree: Tree object or hex or bin sha
+ :param repo: Repo object the commit should be part of
+ :param tree: Tree object or hex or bin sha
the tree of the new commit
:param message: Commit message. It may be an empty string if no message is provided.
It will be converted to a string in any case.
:param parent_commits:
Optional Commit objects to use as parents for the new commit.
- If empty list, the commit will have no parents at all and become
+ If empty list, the commit will have no parents at all and become
a root commit.
- If None , the current head commit will be the parent of the
+ If None , the current head commit will be the parent of the
new commit object
:param head:
If True, the HEAD will be advanced to the new commit automatically.
- Else the HEAD will remain pointing on the previous commit. This could
+ Else the HEAD will remain pointing on the previous commit. This could
lead to undesired results when diffing files.
:return: Commit object representing the new commit
:note:
Additional information about the committer and Author are taken from the
- environment or from the git configuration, see git-commit-tree for
+ environment or from the git configuration, see git-commit-tree for
more information"""
parents = parent_commits
if parent_commits is None:
@@ -293,9 +293,9 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# END handle parent commits
# END if parent commits are unset
- # retrieve all additional information, create a commit object, and
+ # retrieve all additional information, create a commit object, and
# serialize it
- # Generally:
+ # Generally:
# * Environment variables override configuration values
# * Sensible defaults are set according to the git documentation
@@ -318,7 +318,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# END set author time
committer_date_str = env.get(cls.env_committer_date, '')
- if committer_date_str:
+ if committer_date_str:
committer_time, committer_offset = parse_date(committer_date_str)
else:
committer_time, committer_offset = unix_time, offset
@@ -335,8 +335,8 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# END tree conversion
# CREATE NEW COMMIT
- new_commit = cls(repo, cls.NULL_BIN_SHA, tree,
- author, author_time, author_offset,
+ new_commit = cls(repo, cls.NULL_BIN_SHA, tree,
+ author, author_time, author_offset,
committer, committer_time, committer_offset,
message, parent_commits, conf_encoding)
@@ -350,7 +350,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
if head:
# need late import here, importing git at the very beginning throws
- # as well ...
+ # as well ...
import git.refs
try:
repo.head.set_commit(new_commit, logmsg="commit: %s" % message)
@@ -361,7 +361,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
master = git.refs.Head.create(repo, repo.head.ref, new_commit, logmsg="commit (initial): %s" % message)
repo.head.set_reference(master, logmsg='commit: Switching to %s' % master)
# END handle empty repositories
- # END advance head handling
+ # END advance head handling
return new_commit
@@ -381,8 +381,8 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
c = self.committer
fmt = "%s %s <%s> %s %s\n"
- write(fmt % ("author", aname, a.email,
- self.authored_date,
+ write(fmt % ("author", aname, a.email,
+ self.authored_date,
altz_to_utctz_str(self.author_tz_offset)))
# encode committer
@@ -390,7 +390,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
if isinstance(aname, unicode):
aname = aname.encode(self.encoding)
# END handle unicode in name
- write(fmt % ("committer", aname, c.email,
+ write(fmt % ("committer", aname, c.email,
self.committed_date,
altz_to_utctz_str(self.committer_tz_offset)))
@@ -468,14 +468,14 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# decode the authors name
try:
- self.author.name = self.author.name.decode(self.encoding)
+ self.author.name = self.author.name.decode(self.encoding)
except UnicodeDecodeError:
print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % (self.author.name, self.encoding)
# END handle author's encoding
# decode committer name
try:
- self.committer.name = self.committer.name.decode(self.encoding)
+ self.committer.name = self.committer.name.decode(self.encoding)
except UnicodeDecodeError:
print >> sys.stderr, "Failed to decode committer name '%s' using encoding %s" % (self.committer.name, self.encoding)
# END handle author's encoding
@@ -487,7 +487,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
self.message = self.message.decode(self.encoding)
except UnicodeDecodeError:
print >> sys.stderr, "Failed to decode message '%s' using encoding %s" % (self.message, self.encoding)
- # END exception handling
+ # END exception handling
return self
#} END serializable implementation
diff --git a/git/objects/fun.py b/git/objects/fun.py
index 0bb14376..21b89fca 100644
--- a/git/objects/fun.py
+++ b/git/objects/fun.py
@@ -24,13 +24,13 @@ def tree_to_stream(entries, write):
# END save a byte
# here it comes: if the name is actually unicode, the replacement below
- # will not work as the binsha is not part of the ascii unicode encoding -
+ # will not work as the binsha is not part of the ascii unicode encoding -
# hence we must convert to an utf8 string for it to work properly.
# According to my tests, this is exactly what git does, that is it just
# takes the input literally, which appears to be utf8 on linux.
if isinstance(name, unicode):
name = name.encode("utf8")
- write("%s %s\0%s" % (mode_str, name, binsha))
+ write("%s %s\0%s" % (mode_str, name, binsha))
# END for each item
@@ -89,7 +89,7 @@ def tree_entries_from_data(data):
def _find_by_name(tree_data, name, is_dir, start_at):
"""return data entry matching the given name and tree mode
or None.
- Before the item is returned, the respective data item is set
+ Before the item is returned, the respective data item is set
None in the tree_data list to mark it done"""
try:
item = tree_data[start_at]
@@ -117,17 +117,17 @@ def _to_full_path(item, path_prefix):
def traverse_trees_recursive(odb, tree_shas, path_prefix):
"""
- :return: list with entries according to the given binary tree-shas.
+ :return: list with entries according to the given binary tree-shas.
The result is encoded in a list
- of n tuple|None per blob/commit, (n == len(tree_shas)), where
+ of n tuple|None per blob/commit, (n == len(tree_shas)), where
* [0] == 20 byte sha
* [1] == mode as int
* [2] == path relative to working tree root
- The entry tuple is None if the respective blob/commit did not
+ The entry tuple is None if the respective blob/commit did not
exist in the given tree.
- :param tree_shas: iterable of shas pointing to trees. All trees must
+ :param tree_shas: iterable of shas pointing to trees. All trees must
be on the same level. A tree-sha may be None in which case None
- :param path_prefix: a prefix to be added to the returned paths on this level,
+ :param path_prefix: a prefix to be added to the returned paths on this level,
set it '' for the first iteration
:note: The ordering of the returned items will be partially lost"""
trees_data = list()
@@ -158,7 +158,7 @@ def traverse_trees_recursive(odb, tree_shas, path_prefix):
is_dir = S_ISDIR(mode) # type mode bits
# find this item in all other tree data items
- # wrap around, but stop one before our current index, hence
+ # wrap around, but stop one before our current index, hence
# ti+nt, not ti+1+nt
for tio in range(ti + 1, ti + nt):
tio = tio % nt
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index 770dcffd..f26cac91 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -1,17 +1,17 @@
import util
from util import (
mkhead,
- sm_name,
- sm_section,
- unbare_repo,
+ sm_name,
+ sm_section,
+ unbare_repo,
SubmoduleConfigParser,
find_first_remote_branch
)
from git.objects.util import Traversable
from StringIO import StringIO # need a dict to set bloody .name field
from git.util import (
- Iterable,
- join_path_native,
+ Iterable,
+ join_path_native,
to_native_path_linux,
RemoteProgress,
rmtree
@@ -19,7 +19,7 @@ from git.util import (
from git.config import SectionConstraint
from git.exc import (
- InvalidGitRepositoryError,
+ InvalidGitRepositoryError,
NoSuchPathError
)
@@ -35,7 +35,7 @@ __all__ = ["Submodule", "UpdateProgress"]
class UpdateProgress(RemoteProgress):
- """Class providing detailed progress information to the caller who should
+ """Class providing detailed progress information to the caller who should
derive from it and implement the ``update(...)`` message"""
CLONE, FETCH, UPDWKTREE = [1 << x for x in range(RemoteProgress._num_op_codes, RemoteProgress._num_op_codes + 3)]
_num_op_codes = RemoteProgress._num_op_codes + 3
@@ -50,14 +50,14 @@ FETCH = UpdateProgress.FETCH
UPDWKTREE = UpdateProgress.UPDWKTREE
-# IndexObject comes via util module, its a 'hacky' fix thanks to pythons import
+# IndexObject comes via util module, its a 'hacky' fix thanks to pythons import
# mechanism which cause plenty of trouble of the only reason for packages and
# modules is refactoring - subpackages shoudn't depend on parent packages
class Submodule(util.IndexObject, Iterable, Traversable):
"""Implements access to a git submodule. They are special in that their sha
represents a commit in the submodule's repository which is to be checked out
- at the path of this instance.
+ at the path of this instance.
The submodule type does not have a string type associated with it, as it exists
solely as a marker in the tree and index.
@@ -76,7 +76,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
_cache_attrs = ('path', '_url', '_branch_path')
def __init__(self, repo, binsha, mode=None, path=None, name=None, parent_commit=None, url=None, branch_path=None):
- """Initialize this instance with its attributes. We only document the ones
+ """Initialize this instance with its attributes. We only document the ones
that differ from ``IndexObject``
:param repo: Our parent repository
@@ -140,13 +140,13 @@ class Submodule(util.IndexObject, Iterable, Traversable):
return self._name
def __repr__(self):
- return "git.%s(name=%s, path=%s, url=%s, branch_path=%s)" % (type(self).__name__, self._name, self.path, self.url, self.branch_path)
+ return "git.%s(name=%s, path=%s, url=%s, branch_path=%s)" % (type(self).__name__, self._name, self.path, self.url, self.branch_path)
@classmethod
def _config_parser(cls, repo, parent_commit, read_only):
""":return: Config Parser constrained to our submodule in read or write mode
:raise IOError: If the .gitmodules file cannot be found, either locally or in the repository
- at the given parent commit. Otherwise the exception would be delayed until the first
+ at the given parent commit. Otherwise the exception would be delayed until the first
access of the config parser"""
parent_matches_head = repo.head.commit == parent_commit
if not repo.bare and parent_matches_head:
@@ -204,7 +204,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
:param repo: Repository instance which should receive the submodule
:param name: The name/identifier for the submodule
- :param path: repository-relative or absolute path at which the submodule
+ :param path: repository-relative or absolute path at which the submodule
should be located
It will be created as required during the repository initialization.
:param url: git-clone compatible URL, see git-clone reference for more information
@@ -219,7 +219,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
The result you get in these situation is somewhat fuzzy, and it is recommended
to specify at least 'master' here.
Examples are 'master' or 'feature/new'
- :param no_checkout: if True, and if the repository has to be cloned manually,
+ :param no_checkout: if True, and if the repository has to be cloned manually,
no checkout will be performed
:return: The newly created submodule instance
:note: works atomically, such that no change will be done if the repository
@@ -233,8 +233,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
path = path[:-1]
# END handle trailing slash
- # assure we never put backslashes into the url, as some operating systems
- # like it ...
+ # assure we never put backslashes into the url, as some operating systems
+ # like it ...
if url != None:
url = to_native_path_linux(url)
#END assure url correctness
@@ -306,7 +306,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
return sm
- def update(self, recursive=False, init=True, to_latest_revision=False, progress=None,
+ def update(self, recursive=False, init=True, to_latest_revision=False, progress=None,
dry_run=False):
"""Update the repository of this submodule to point to the checkout
we point at with the binsha of this instance.
@@ -317,7 +317,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
:param to_latest_revision: if True, the submodule's sha will be ignored during checkout.
Instead, the remote will be fetched, and the local tracking branch updated.
This only works if we have a local tracking branch, which is the case
- if the remote repository had a master branch, or of the 'branch' option
+ if the remote repository had a master branch, or of the 'branch' option
was specified for this submodule and the branch existed remotely
:param progress: UpdateProgress instance or None of no progress should be shown
:param dry_run: if True, the operation will only be simulated, but not performed.
@@ -405,12 +405,12 @@ class Submodule(util.IndexObject, Iterable, Traversable):
mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch)
mrepo.head.ref.set_tracking_branch(remote_branch)
except IndexError:
- print >> sys.stderr, "Warning: Failed to checkout tracking branch %s" % self.branch_path
+ print >> sys.stderr, "Warning: Failed to checkout tracking branch %s" % self.branch_path
#END handle tracking branch
# NOTE: Have to write the repo config file as well, otherwise
# the default implementation will be offended and not update the repository
- # Maybe this is a good way to assure it doesn't get into our way, but
+ # Maybe this is a good way to assure it doesn't get into our way, but
# we want to stay backwards compatible too ... . Its so redundant !
self.repo.config_writer().set_value(sm_section(self.name), 'url', self.url)
#END handle dry_run
@@ -434,7 +434,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
binsha = rcommit.binsha
hexsha = rcommit.hexsha
else:
- print >> sys.stderr, "%s a tracking branch was not set for local branch '%s'" % (msg_base, mrepo.head.ref)
+ print >> sys.stderr, "%s a tracking branch was not set for local branch '%s'" % (msg_base, mrepo.head.ref)
# END handle remote ref
else:
print >> sys.stderr, "%s there was no local tracking branch" % msg_base
@@ -448,7 +448,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
if not dry_run:
if is_detached:
# NOTE: for now we force, the user is no supposed to change detached
- # submodules anyway. Maybe at some point this becomes an option, to
+ # submodules anyway. Maybe at some point this becomes an option, to
# properly handle user modifications - see below for future options
# regarding rebase and merge.
mrepo.git.checkout(hexsha, force=True)
@@ -485,10 +485,10 @@ class Submodule(util.IndexObject, Iterable, Traversable):
repository-relative path. Intermediate directories will be created
accordingly. If the path already exists, it must be empty.
Trailling (back)slashes are removed automatically
- :param configuration: if True, the configuration will be adjusted to let
+ :param configuration: if True, the configuration will be adjusted to let
the submodule point to the given path.
:param module: if True, the repository managed by this submodule
- will be moved, not the configuration. This will effectively
+ will be moved, not the configuration. This will effectively
leave your repository in an inconsistent state unless the configuration
and index already point to the target location.
:return: self
@@ -549,7 +549,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
renamed_module = True
#END move physical module
- # rename the index entry - have to manipulate the index directly as
+ # rename the index entry - have to manipulate the index directly as
# git-mv cannot be used on submodules ... yeah
try:
if configuration:
@@ -583,20 +583,20 @@ class Submodule(util.IndexObject, Iterable, Traversable):
"""Remove this submodule from the repository. This will remove our entry
from the .gitmodules file and the entry in the .git/config file.
- :param module: If True, the module we point to will be deleted
- as well. If the module is currently on a commit which is not part
- of any branch in the remote, if the currently checked out branch
+ :param module: If True, the module we point to will be deleted
+ as well. If the module is currently on a commit which is not part
+ of any branch in the remote, if the currently checked out branch
working tree, or untracked files,
is ahead of its tracking branch, if you have modifications in the
- In case the removal of the repository fails for these reasons, the
+ In case the removal of the repository fails for these reasons, the
submodule status will not have been altered.
If this submodule has child-modules on its own, these will be deleted
prior to touching the own module.
- :param force: Enforces the deletion of the module even though it contains
+ :param force: Enforces the deletion of the module even though it contains
modifications. This basically enforces a brute-force file system based
deletion.
- :param configuration: if True, the submodule is deleted from the configuration,
- otherwise it isn't. Although this should be enabled most of the times,
+ :param configuration: if True, the submodule is deleted from the configuration,
+ otherwise it isn't. Although this should be enabled most of the times,
this flag enables you to safely delete the repository of your submodule.
:param dry_run: if True, we will not actually do anything, but throw the errors
we would usually throw
@@ -636,7 +636,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
# END check for dirt
# figure out whether we have new commits compared to the remotes
- # NOTE: If the user pulled all the time, the remote heads might
+ # NOTE: If the user pulled all the time, the remote heads might
# not have been updated, so commits coming from the remote look
# as if they come from us. But we stay strictly read-only and
# don't fetch beforhand.
@@ -650,7 +650,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
if num_branches_with_new_commits == len(rrefs):
raise InvalidGitRepositoryError("Cannot delete module at %s as there are new commits" % mod.working_tree_dir)
# END handle new commits
- # have to manually delete references as python's scoping is
+ # have to manually delete references as python's scoping is
# not existing, they could keep handles open ( on windows this is a problem )
if len(rrefs):
del(rref)
@@ -686,7 +686,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
#END delete entry
index.write()
- # now git config - need the config intact, otherwise we can't query
+ # now git config - need the config intact, otherwise we can't query
# inforamtion anymore
self.repo.config_writer().remove_section(sm_section(self.name))
self.config_writer().remove_section()
@@ -698,7 +698,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
return self
def set_parent_commit(self, commit, check=True):
- """Set this instance to use the given commit whose tree is supposed to
+ """Set this instance to use the given commit whose tree is supposed to
contain the .gitmodules blob.
:param commit: Commit'ish reference pointing at the root_tree
@@ -721,7 +721,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
parser = self._config_parser(self.repo, self._parent_commit, read_only=True)
if not parser.has_section(sm_section(self.name)):
self._parent_commit = prev_pc
- raise ValueError("Submodule at path %r did not exist in parent commit %s" % (self.path, commit))
+ raise ValueError("Submodule at path %r did not exist in parent commit %s" % (self.path, commit))
# END handle submodule did not exist
# END handle checking mode
@@ -741,8 +741,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
defaults to the index of the Submodule's parent repository.
:param write: if True, the index will be written each time a configuration
value changes.
- :note: the parameters allow for a more efficient writing of the index,
- as you can pass in a modified index on your own, prevent automatic writing,
+ :note: the parameters allow for a more efficient writing of the index,
+ as you can pass in a modified index on your own, prevent automatic writing,
and write yourself once the whole operation is complete
:raise ValueError: if trying to get a writer on a parent_commit which does not
match the current head commit
@@ -760,10 +760,10 @@ class Submodule(util.IndexObject, Iterable, Traversable):
@unbare_repo
def module(self):
""":return: Repo instance initialized from the repository at our submodule path
- :raise InvalidGitRepositoryError: if a repository was not available. This could
+ :raise InvalidGitRepositoryError: if a repository was not available. This could
also mean that it was not yet initialized"""
# late import to workaround circular dependencies
- module_path = self.abspath
+ module_path = self.abspath
try:
repo = git.Repo(module_path)
if repo != self.repo:
@@ -847,7 +847,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
@property
def name(self):
- """:return: The name of this submodule. It is used to identify it within the
+ """:return: The name of this submodule. It is used to identify it within the
.gitmodules file.
:note: by default, the name is the path at which to find the submodule, but
in git-python it should be a unique identifier similar to the identifiers
diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py
index b8cc904c..581c5a7c 100644
--- a/git/objects/submodule/root.py
+++ b/git/objects/submodule/root.py
@@ -38,11 +38,11 @@ class RootModule(Submodule):
def __init__(self, repo):
# repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None)
super(RootModule, self).__init__(
- repo,
- binsha=self.NULL_BIN_SHA,
- mode=self.k_default_mode,
- path='',
- name=self.k_root_name,
+ repo,
+ binsha=self.NULL_BIN_SHA,
+ mode=self.k_default_mode,
+ path='',
+ name=self.k_root_name,
parent_commit=repo.head.commit,
url='',
branch_path=git.Head.to_full_path(self.k_head_default)
@@ -52,28 +52,28 @@ class RootModule(Submodule):
"""May not do anything"""
pass
- #{ Interface
+ #{ Interface
- def update(self, previous_commit=None, recursive=True, force_remove=False, init=True,
+ def update(self, previous_commit=None, recursive=True, force_remove=False, init=True,
to_latest_revision=False, progress=None, dry_run=False):
"""Update the submodules of this repository to the current HEAD commit.
This method behaves smartly by determining changes of the path of a submodules
- repository, next to changes to the to-be-checked-out commit or the branch to be
+ repository, next to changes to the to-be-checked-out commit or the branch to be
checked out. This works if the submodules ID does not change.
Additionally it will detect addition and removal of submodules, which will be handled
gracefully.
- :param previous_commit: If set to a commit'ish, the commit we should use
- as the previous commit the HEAD pointed to before it was set to the commit it points to now.
+ :param previous_commit: If set to a commit'ish, the commit we should use
+ as the previous commit the HEAD pointed to before it was set to the commit it points to now.
If None, it defaults to HEAD@{1} otherwise
:param recursive: if True, the children of submodules will be updated as well
using the same technique
:param force_remove: If submodules have been deleted, they will be forcibly removed.
- Otherwise the update may fail if a submodule's repository cannot be deleted as
+ Otherwise the update may fail if a submodule's repository cannot be deleted as
changes have been made to it (see Submodule.update() for more information)
:param init: If we encounter a new module which would need to be initialized, then do it.
- :param to_latest_revision: If True, instead of checking out the revision pointed to
- by this submodule's sha, the checked out tracking branch will be merged with the
+ :param to_latest_revision: If True, instead of checking out the revision pointed to
+ by this submodule's sha, the checked out tracking branch will be merged with the
newest remote branch fetched from the repository's origin
:param progress: RootUpdateProgress instance or None if no progress should be sent
:param dry_run: if True, operations will not actually be performed. Progress messages
@@ -106,7 +106,7 @@ class RootModule(Submodule):
previous_commit = cur_commit
#END exception handling
else:
- previous_commit = repo.commit(previous_commit) # obtain commit object
+ previous_commit = repo.commit(previous_commit) # obtain commit object
# END handle previous commit
psms = self.list_items(repo, parent_commit=previous_commit)
@@ -150,7 +150,7 @@ class RootModule(Submodule):
#PATH CHANGES
##############
if sm.path != psm.path and psm.module_exists():
- progress.update(BEGIN | PATHCHANGE, i, len_csms, prefix + "Moving repository of submodule %r from %s to %s" % (sm.name, psm.abspath, sm.abspath))
+ progress.update(BEGIN | PATHCHANGE, i, len_csms, prefix + "Moving repository of submodule %r from %s to %s" % (sm.name, psm.abspath, sm.abspath))
# move the module to the new path
if not dry_run:
psm.move(sm.path, module=True, configuration=False)
@@ -163,7 +163,7 @@ class RootModule(Submodule):
###################
if sm.url != psm.url:
# Add the new remote, remove the old one
- # This way, if the url just changes, the commits will not
+ # This way, if the url just changes, the commits will not
# have to be re-retrieved
nn = '__new_origin__'
smm = sm.module()
@@ -193,14 +193,14 @@ class RootModule(Submodule):
# END if urls match
# END for each remote
- # if we didn't find a matching remote, but have exactly one,
+ # if we didn't find a matching remote, but have exactly one,
# we can safely use this one
if rmt_for_deletion is None:
if len(rmts) == 1:
rmt_for_deletion = rmts[0]
else:
# if we have not found any remote with the original url
- # we may not have a name. This is a special case,
+ # we may not have a name. This is a special case,
# and its okay to fail here
# Alternatively we could just generate a unique name and leave all
# existing ones in place
@@ -211,8 +211,8 @@ class RootModule(Submodule):
orig_name = rmt_for_deletion.name
smm.delete_remote(rmt_for_deletion)
# NOTE: Currently we leave tags from the deleted remotes
- # as well as separate tracking branches in the possibly totally
- # changed repository ( someone could have changed the url to
+ # as well as separate tracking branches in the possibly totally
+ # changed repository ( someone could have changed the url to
# another project ). At some point, one might want to clean
# it up, but the danger is high to remove stuff the user
# has added explicitly
@@ -221,7 +221,7 @@ class RootModule(Submodule):
smr.rename(orig_name)
# early on, we verified that the our current tracking branch
- # exists in the remote. Now we have to assure that the
+ # exists in the remote. Now we have to assure that the
# sha we point to is still contained in the new remote
# tracking branch.
smsha = sm.binsha
@@ -237,7 +237,7 @@ class RootModule(Submodule):
if not found:
# adjust our internal binsha to use the one of the remote
# this way, it will be checked out in the next step
- # This will change the submodule relative to us, so
+ # This will change the submodule relative to us, so
# the user will be able to commit the change easily
print >> sys.stderr, "WARNING: Current sha %s was not contained in the tracking branch at the new remote, setting it the the remote's tracking branch" % sm.hexsha
sm.binsha = rref.commit.binsha
@@ -252,7 +252,7 @@ class RootModule(Submodule):
# HANDLE PATH CHANGES
#####################
if sm.branch_path != psm.branch_path:
- # finally, create a new tracking branch which tracks the
+ # finally, create a new tracking branch which tracks the
# new remote branch
progress.update(BEGIN | BRANCHCHANGE, i, len_csms, prefix + "Changing branch of submodule %r from %s to %s" % (sm.name, psm.branch_path, sm.branch_path))
if not dry_run:
@@ -267,7 +267,7 @@ class RootModule(Submodule):
tbr.set_tracking_branch(find_first_remote_branch(smmr, sm.branch_name))
# figure out whether the previous tracking branch contains
- # new commits compared to the other one, if not we can
+ # new commits compared to the other one, if not we can
# delete it.
try:
tbr = find_first_remote_branch(smmr, psm.branch_name)
@@ -285,24 +285,24 @@ class RootModule(Submodule):
progress.update(END | BRANCHCHANGE, i, len_csms, prefix + "Done changing branch of submodule %r" % sm.name)
#END handle branch
- #END handle
- # END for each common submodule
+ #END handle
+ # END for each common submodule
# FINALLY UPDATE ALL ACTUAL SUBMODULES
######################################
for sm in sms:
# update the submodule using the default method
- sm.update(recursive=False, init=init, to_latest_revision=to_latest_revision,
+ sm.update(recursive=False, init=init, to_latest_revision=to_latest_revision,
progress=progress, dry_run=dry_run)
- # update recursively depth first - question is which inconsitent
+ # update recursively depth first - question is which inconsitent
# state will be better in case it fails somewhere. Defective branch
- # or defective depth. The RootSubmodule type will never process itself,
+ # or defective depth. The RootSubmodule type will never process itself,
# which was done in the previous expression
if recursive:
# the module would exist by now if we are not in dry_run mode
if sm.module_exists():
- type(self)(sm.module()).update(recursive=True, force_remove=force_remove,
+ type(self)(sm.module()).update(recursive=True, force_remove=force_remove,
init=init, to_latest_revision=to_latest_revision,
progress=progress, dry_run=dry_run)
#END handle dry_run
diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py
index a66fcddc..bbdf5e1e 100644
--- a/git/objects/submodule/util.py
+++ b/git/objects/submodule/util.py
@@ -4,7 +4,7 @@ from git.config import GitConfigParser
from StringIO import StringIO
import weakref
-__all__ = ('sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch',
+__all__ = ('sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch',
'SubmoduleConfigParser')
#{ Utilities
@@ -27,7 +27,7 @@ def mkhead(repo, path):
def unbare_repo(func):
- """Methods with this decorator raise InvalidGitRepositoryError if they
+ """Methods with this decorator raise InvalidGitRepositoryError if they
encounter a bare repository"""
def wrapper(self, *args, **kwargs):
@@ -60,7 +60,7 @@ class SubmoduleConfigParser(GitConfigParser):
"""
Catches calls to _write, and updates the .gitmodules blob in the index
- with the new data, if we have written into a stream. Otherwise it will
+ with the new data, if we have written into a stream. Otherwise it will
add the local file to the index to make it correspond with the working tree.
Additionally, the cache must be cleared
@@ -75,7 +75,7 @@ class SubmoduleConfigParser(GitConfigParser):
#{ Interface
def set_submodule(self, submodule):
- """Set this instance's submodule. It must be called before
+ """Set this instance's submodule. It must be called before
the first write operation begins"""
self._smref = weakref.ref(submodule)
diff --git a/git/objects/tag.py b/git/objects/tag.py
index 345bb1d5..3fd7a4d4 100644
--- a/git/objects/tag.py
+++ b/git/objects/tag.py
@@ -20,7 +20,7 @@ class TagObject(base.Object):
type = "tag"
__slots__ = ("object", "tag", "tagger", "tagged_date", "tagger_tz_offset", "message")
- def __init__(self, repo, binsha, object=None, tag=None,
+ def __init__(self, repo, binsha, object=None, tag=None,
tagger=None, tagged_date=None, tagger_tz_offset=None, message=None):
"""Initialize a tag object with additional data
@@ -30,9 +30,9 @@ class TagObject(base.Object):
:param tag: name of this tag
:param tagger: Actor identifying the tagger
:param tagged_date: int_seconds_since_epoch
- is the DateTime of the tag creation - use time.gmtime to convert
+ is the DateTime of the tag creation - use time.gmtime to convert
it into a different format
- :param tagged_tz_offset: int_seconds_west_of_utc is the timezone that the
+ :param tagged_tz_offset: int_seconds_west_of_utc is the timezone that the
authored_date is in, in a format similar to time.altzone"""
super(TagObject, self).__init__(repo, binsha)
if object is not None:
@@ -64,7 +64,7 @@ class TagObject(base.Object):
self.tagger, self.tagged_date, self.tagger_tz_offset = parse_actor_and_date(tagger_info)
# line 4 empty - it could mark the beginning of the next header
- # in case there really is no message, it would not exist. Otherwise
+ # in case there really is no message, it would not exist. Otherwise
# a newline separates header from message
if len(lines) > 5:
self.message = "\n".join(lines[5:])
diff --git a/git/objects/tree.py b/git/objects/tree.py
index e4e49d1a..cc3699f5 100644
--- a/git/objects/tree.py
+++ b/git/objects/tree.py
@@ -11,12 +11,12 @@ from submodule.base import Submodule
import git.diff as diff
from fun import (
- tree_entries_from_data,
+ tree_entries_from_data,
tree_to_stream
)
from gitdb.util import (
- to_bin_sha,
+ to_bin_sha,
)
__all__ = ("TreeModifier", "Tree")
@@ -26,7 +26,7 @@ class TreeModifier(object):
"""A utility class providing methods to alter the underlying cache in a list-like fashion.
- Once all adjustments are complete, the _cache, which really is a refernce to
+ Once all adjustments are complete, the _cache, which really is a refernce to
the cache of a tree, will be sorted. Assuring it will be in a serializable state"""
__slots__ = '_cache'
@@ -42,10 +42,10 @@ class TreeModifier(object):
# END for each item in cache
return -1
- #{ Interface
+ #{ Interface
def set_done(self):
"""Call this method once you are done modifying the tree information.
- It may be called several times, but be aware that each call will cause
+ It may be called several times, but be aware that each call will cause
a sort operation
:return self:"""
self._cache.sort(key=lambda t: t[2]) # sort by name
@@ -55,8 +55,8 @@ class TreeModifier(object):
#{ Mutators
def add(self, sha, mode, name, force=False):
"""Add the given item to the tree. If an item with the given name already
- exists, nothing will be done, but a ValueError will be raised if the
- sha and mode of the existing item do not match the one you add, unless
+ exists, nothing will be done, but a ValueError will be raised if the
+ sha and mode of the existing item do not match the one you add, unless
force is True
:param sha: The 20 or 40 byte sha of the item to add
@@ -87,8 +87,8 @@ class TreeModifier(object):
return self
def add_unchecked(self, binsha, mode, name):
- """Add the given item to the tree, its correctness is assumed, which
- puts the caller into responsibility to assure the input is correct.
+ """Add the given item to the tree, its correctness is assumed, which
+ puts the caller into responsibility to assure the input is correct.
For more information on the parameters, see ``add``
:param binsha: 20 byte binary sha"""
self._cache.append((binsha, mode, name))
@@ -108,7 +108,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
``Tree as a list``::
- Access a specific blob using the
+ Access a specific blob using the
tree['filename'] notation.
You may as well access by index
@@ -118,15 +118,15 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
type = "tree"
__slots__ = "_cache"
- # actual integer ids for comparison
+ # actual integer ids for comparison
commit_id = 016 # equals stat.S_IFDIR | stat.S_IFLNK - a directory link
blob_id = 010
symlink_id = 012
tree_id = 004
_map_id_to_type = {
- commit_id: Submodule,
- blob_id: Blob,
+ commit_id: Submodule,
+ blob_id: Blob,
symlink_id: Blob
# tree id added once Tree is defined
}
@@ -147,7 +147,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
self._cache = tree_entries_from_data(ostream.read())
else:
super(Tree, self)._set_cache_(attr)
- # END handle attribute
+ # END handle attribute
def _iter_convert_to_object(self, iterable):
"""Iterable yields tuples of (binsha, mode, name), which will be converted
@@ -158,7 +158,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
yield self._map_id_to_type[mode >> 12](self.repo, binsha, mode, path)
except KeyError:
raise TypeError("Unknown mode %o found in tree data for path '%s'" % (mode, path))
- # END for each item
+ # END for each item
def __div__(self, file):
"""Find the named object in this tree's contents
@@ -236,7 +236,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
if isinstance(item, basestring):
# compatability
return self.__div__(item)
- # END index is basestring
+ # END index is basestring
raise TypeError("Invalid index type: %r" % item)
@@ -262,7 +262,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
return reversed(self._iter_convert_to_object(self._cache))
def _serialize(self, stream):
- """Serialize this tree into the stream. Please note that we will assume
+ """Serialize this tree into the stream. Please note that we will assume
our tree data to be in a sorted state. If this is not the case, serialization
will not generate a correct tree representation as these are assumed to be sorted
by algorithms"""
diff --git a/git/objects/util.py b/git/objects/util.py
index 6321399d..f6daca0f 100644
--- a/git/objects/util.py
+++ b/git/objects/util.py
@@ -5,7 +5,7 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module for general utility functions"""
from git.util import (
- IterableList,
+ IterableList,
Actor
)
@@ -16,8 +16,8 @@ from string import digits
import time
import os
-__all__ = ('get_object_type_by_name', 'parse_date', 'parse_actor_and_date',
- 'ProcessStreamAdapter', 'Traversable', 'altz_to_utctz_str', 'utctz_to_altz',
+__all__ = ('get_object_type_by_name', 'parse_date', 'parse_actor_and_date',
+ 'ProcessStreamAdapter', 'Traversable', 'altz_to_utctz_str', 'utctz_to_altz',
'verify_utctz', 'Actor')
#{ Functions
@@ -27,8 +27,8 @@ def mode_str_to_int(modestr):
"""
:param modestr: string like 755 or 644 or 100644 - only the last 6 chars will be used
:return:
- String identifying a mode compatible to the mode methods ids of the
- stat module regarding the rwx permissions for user, group and other,
+ String identifying a mode compatible to the mode methods ids of the
+ stat module regarding the rwx permissions for user, group and other,
special flags and file system flags, i.e. whether it is a symlink
for example."""
mode = 0
@@ -64,7 +64,7 @@ def get_object_type_by_name(object_type_name):
def utctz_to_altz(utctz):
"""we convert utctz to the timezone in seconds, it is the format time.altzone
- returns. Git stores it as UTC timezone which has the opposite sign as well,
+ returns. Git stores it as UTC timezone which has the opposite sign as well,
which explains the -1 * ( that was made explicit here )
:param utctz: git utc timezone string, i.e. +0200"""
return -1 * int(float(utctz) / 100 * 3600)
@@ -102,7 +102,7 @@ def parse_date(string_date):
Parse the given date as one of the following
* Git internal format: timestamp offset
- * RFC 2822: Thu, 07 Apr 2005 22:13:13 +0200.
+ * RFC 2822: Thu, 07 Apr 2005 22:13:13 +0200.
* ISO 8601 2005-04-07T22:13:13
The T can be a space as well
@@ -139,7 +139,7 @@ def parse_date(string_date):
if splitter == -1:
splitter = string_date.rfind(' ')
# END handle 'T' and ' '
- # END handle rfc or iso
+ # END handle rfc or iso
assert splitter > -1
@@ -153,7 +153,7 @@ def parse_date(string_date):
for fmt in date_formats:
try:
dtstruct = time.strptime(date_part, fmt)
- fstruct = time.struct_time((dtstruct.tm_year, dtstruct.tm_mon, dtstruct.tm_mday,
+ fstruct = time.struct_time((dtstruct.tm_year, dtstruct.tm_mon, dtstruct.tm_mday,
tstruct.tm_hour, tstruct.tm_min, tstruct.tm_sec,
dtstruct.tm_wday, dtstruct.tm_yday, tstruct.tm_isdst))
return int(time.mktime(fstruct)), utctz_to_altz(offset)
@@ -166,7 +166,7 @@ def parse_date(string_date):
raise ValueError("no format matched")
# END handle format
except Exception:
- raise ValueError("Unsupported date format: %s" % string_date)
+ raise ValueError("Unsupported date format: %s" % string_date)
# END handle exceptions
@@ -193,14 +193,14 @@ def parse_actor_and_date(line):
#} END functions
-#{ Classes
+#{ Classes
class ProcessStreamAdapter(object):
"""Class wireing all calls to the contained Process instance.
- Use this type to hide the underlying process to provide access only to a specified
- stream. The process is usually wrapped into an AutoInterrupt class to kill
+ Use this type to hide the underlying process to provide access only to a specified
+ stream. The process is usually wrapped into an AutoInterrupt class to kill
it if the instance goes out of scope."""
__slots__ = ("_proc", "_stream")
@@ -214,7 +214,7 @@ class ProcessStreamAdapter(object):
class Traversable(object):
- """Simple interface to perforam depth-first or breadth-first traversals
+ """Simple interface to perforam depth-first or breadth-first traversals
into one direction.
Subclasses only need to implement one function.
Instances of the Subclass must be hashable"""
@@ -244,7 +244,7 @@ class Traversable(object):
:param predicate: f(i,d) returns False if item i at depth d should not be included in the result
- :param prune:
+ :param prune:
f(i,d) return True if the search should stop at item i at depth d.
Item i will not be returned.
@@ -267,8 +267,8 @@ class Traversable(object):
If as_edge is True, the source of the first edge is None
:param as_edge:
- if True, return a pair of items, first being the source, second the
- destinatination, i.e. tuple(src, dest) with the edge spanning from
+ if True, return a pair of items, first being the source, second the
+ destinatination, i.e. tuple(src, dest) with the edge spanning from
source to destination"""
visited = set()
stack = Deque()
diff --git a/git/odict.py b/git/odict.py
index 96444ca0..dbedbde7 100644
--- a/git/odict.py
+++ b/git/odict.py
@@ -491,7 +491,7 @@ class OrderedDict(dict):
def items(self):
"""
- ``items`` returns a list of tuples representing all the
+ ``items`` returns a list of tuples representing all the
``(key, value)`` pairs in the dictionary.
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
@@ -735,7 +735,7 @@ class OrderedDict(dict):
if new_key in self:
raise ValueError("New key already exists: %r" % new_key)
# rename sequence entry
- value = self[old_key]
+ value = self[old_key]
old_idx = self._sequence.index(old_key)
self._sequence[old_idx] = new_key
# rename internal dict entry
diff --git a/git/refs/head.py b/git/refs/head.py
index 958f83fa..2ef7c23e 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -12,7 +12,7 @@ __all__ = ["HEAD", "Head"]
class HEAD(SymbolicReference):
- """Special case of a Symbolic Reference as it represents the repository's
+ """Special case of a Symbolic Reference as it represents the repository's
HEAD reference."""
_HEAD_NAME = 'HEAD'
_ORIG_HEAD_NAME = 'ORIG_HEAD'
@@ -25,18 +25,18 @@ class HEAD(SymbolicReference):
def orig_head(self):
"""
- :return: SymbolicReference pointing at the ORIG_HEAD, which is maintained
+ :return: SymbolicReference pointing at the ORIG_HEAD, which is maintained
to contain the previous value of HEAD"""
return SymbolicReference(self.repo, self._ORIG_HEAD_NAME)
- def reset(self, commit='HEAD', index=True, working_tree=False,
+ def reset(self, commit='HEAD', index=True, working_tree=False,
paths=None, **kwargs):
- """Reset our HEAD to the given commit optionally synchronizing
- the index and working tree. The reference we refer to will be set to
+ """Reset our HEAD to the given commit optionally synchronizing
+ the index and working tree. The reference we refer to will be set to
commit as well.
:param commit:
- Commit object, Reference Object or string identifying a revision we
+ Commit object, Reference Object or string identifying a revision we
should reset HEAD to.
:param index:
@@ -53,7 +53,7 @@ class HEAD(SymbolicReference):
that are to be reset. This allows to partially reset individual files.
:param kwargs:
- Additional arguments passed to git-reset.
+ Additional arguments passed to git-reset.
:return: self"""
mode = "--soft"
@@ -131,7 +131,7 @@ class Head(Reference):
Configure this branch to track the given remote reference. This will alter
this branch's configuration accordingly.
- :param remote_reference: The remote reference to track or None to untrack
+ :param remote_reference: The remote reference to track or None to untrack
any references
:return: self"""
if remote_reference is not None and not isinstance(remote_reference, RemoteReference):
@@ -154,7 +154,7 @@ class Head(Reference):
def tracking_branch(self):
"""
- :return: The remote_reference we are tracking, or None if we are
+ :return: The remote_reference we are tracking, or None if we are
not a tracking branch"""
reader = self.config_reader()
if reader.has_option(self.k_config_remote) and reader.has_option(self.k_config_remote_ref):
@@ -189,7 +189,7 @@ class Head(Reference):
def checkout(self, force=False, **kwargs):
"""Checkout this head by setting the HEAD to this reference, by updating the index
- to reflect the tree we point to and by updating the working tree to reflect
+ to reflect the tree we point to and by updating the working tree to reflect
the latest index.
The command will fail if changed working tree files would be overwritten.
@@ -231,7 +231,7 @@ class Head(Reference):
def config_reader(self):
"""
- :return: A configuration parser instance constrained to only read
+ :return: A configuration parser instance constrained to only read
this instance's values"""
return self._config_parser(read_only=True)
diff --git a/git/refs/log.py b/git/refs/log.py
index c075e7a0..7249aec5 100644
--- a/git/refs/log.py
+++ b/git/refs/log.py
@@ -15,7 +15,7 @@ from gitdb.util import (
from git.objects.util import (
parse_date,
- Serializable,
+ Serializable,
utctz_to_altz,
altz_to_utctz_str,
)
@@ -38,12 +38,12 @@ class RefLogEntry(tuple):
"""Representation of ourselves in git reflog format"""
act = self.actor
time = self.time
- return self._fmt % (self.oldhexsha, self.newhexsha, act.name, act.email,
+ return self._fmt % (self.oldhexsha, self.newhexsha, act.name, act.email,
time[0], altz_to_utctz_str(time[1]), self.message)
@property
def oldhexsha(self):
- """The hexsha to the commit the ref pointed to before the change"""
+ """The hexsha to the commit the ref pointed to before the change"""
return self[0]
@property
@@ -74,7 +74,7 @@ class RefLogEntry(tuple):
""":return: New instance of a RefLogEntry"""
if not isinstance(actor, Actor):
raise ValueError("Need actor instance, got %s" % actor)
- # END check types
+ # END check types
return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), message))
@classmethod
@@ -109,7 +109,7 @@ class RefLogEntry(tuple):
class RefLog(list, Serializable):
"""A reflog contains reflog entries, each of which defines a certain state
- of the head in question. Custom query methods allow to retrieve log entries
+ of the head in question. Custom query methods allow to retrieve log entries
by date or by other criteria.
Reflog entries are orded, the first added entry is first in the list, the last
@@ -123,7 +123,7 @@ class RefLog(list, Serializable):
def __init__(self, filepath=None):
"""Initialize this instance with an optional filepath, from which we will
- initialize our data. The path is also used to write changes back using
+ initialize our data. The path is also used to write changes back using
the write() method"""
self._path = filepath
if filepath is not None:
@@ -149,17 +149,17 @@ class RefLog(list, Serializable):
@classmethod
def from_file(cls, filepath):
"""
- :return: a new RefLog instance containing all entries from the reflog
+ :return: a new RefLog instance containing all entries from the reflog
at the given filepath
- :param filepath: path to reflog
+ :param filepath: path to reflog
:raise ValueError: If the file could not be read or was corrupted in some way"""
return cls(filepath)
@classmethod
def path(cls, ref):
"""
- :return: string to absolute path at which the reflog of the given ref
- instance would be found. The path is not guaranteed to point to a valid
+ :return: string to absolute path at which the reflog of the given ref
+ instance would be found. The path is not guaranteed to point to a valid
file though.
:param ref: SymbolicReference instance"""
return join(ref.repo.git_dir, "logs", to_native_path(ref.path))
@@ -167,7 +167,7 @@ class RefLog(list, Serializable):
@classmethod
def iter_entries(cls, stream):
"""
- :return: Iterator yielding RefLogEntry instances, one for each line read
+ :return: Iterator yielding RefLogEntry instances, one for each line read
sfrom the given stream.
:param stream: file-like object containing the revlog in its native format
or basestring instance pointing to a file to read"""
@@ -186,13 +186,13 @@ class RefLog(list, Serializable):
def entry_at(cls, filepath, index):
""":return: RefLogEntry at the given index
:param filepath: full path to the index file from which to read the entry
- :param index: python list compatible index, i.e. it may be negative to
+ :param index: python list compatible index, i.e. it may be negative to
specifiy an entry counted from the end of the list
:raise IndexError: If the entry didn't exist
.. note:: This method is faster as it only parses the entry at index, skipping
- all other lines. Nonetheless, the whole file has to be read if
+ all other lines. Nonetheless, the whole file has to be read if
the index is negative
"""
fp = open(filepath, 'rb')
@@ -243,7 +243,7 @@ class RefLog(list, Serializable):
:param write: If True, the changes will be written right away. Otherwise
the change will not be written
:return: RefLogEntry objects which was appended to the log
- :note: As we are append-only, concurrent access is not a problem as we
+ :note: As we are append-only, concurrent access is not a problem as we
do not interfere with readers."""
if len(oldbinsha) != 20 or len(newbinsha) != 20:
raise ValueError("Shas need to be given in binary format")
diff --git a/git/refs/reference.py b/git/refs/reference.py
index dc745cce..0745b721 100644
--- a/git/refs/reference.py
+++ b/git/refs/reference.py
@@ -1,7 +1,7 @@
from symbolic import SymbolicReference
from git.util import (
- LazyMixin,
- Iterable,
+ LazyMixin,
+ Iterable,
)
from gitdb.util import (
@@ -29,7 +29,7 @@ def require_remote_ref_path(func):
class Reference(SymbolicReference, LazyMixin, Iterable):
- """Represents a named reference to any object. Subclasses may apply restrictions though,
+ """Represents a named reference to any object. Subclasses may apply restrictions though,
i.e. Heads can only point to commits."""
__slots__ = tuple()
_points_to_commits_only = False
@@ -43,7 +43,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
:param path:
Path relative to the .git/ directory pointing to the ref in question, i.e.
refs/heads/master
- :param check_path: if False, you can provide any path. Otherwise the path must start with the
+ :param check_path: if False, you can provide any path. Otherwise the path must start with the
default path prefix of this type."""
if check_path and not path.startswith(self._common_path_default + '/'):
raise ValueError("Cannot instantiate %r from path %s" % (self.__class__.__name__, path))
@@ -87,7 +87,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
@property
def name(self):
""":return: (shortest) Name of this reference - it may contain path components"""
- # first two path tokens are can be removed as they are
+ # first two path tokens are can be removed as they are
# refs/heads or refs/tags or refs/remotes
tokens = self.path.split('/')
if len(tokens) < 3:
diff --git a/git/refs/remote.py b/git/refs/remote.py
index 394ad9e5..e3827ad9 100644
--- a/git/refs/remote.py
+++ b/git/refs/remote.py
@@ -26,11 +26,11 @@ class RemoteReference(Head):
def delete(cls, repo, *refs, **kwargs):
"""Delete the given remote references.
:note:
- kwargs are given for compatability with the base class method as we
+ kwargs are given for compatability with the base class method as we
should not narrow the signature."""
repo.git.branch("-d", "-r", *refs)
- # the official deletion method will ignore remote symbolic refs - these
- # are generally ignored in the refs/ folder. We don't though
+ # the official deletion method will ignore remote symbolic refs - these
+ # are generally ignored in the refs/ folder. We don't though
# and delete remainders manually
for ref in refs:
try:
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py
index 4082e74a..9f9eb9f5 100644
--- a/git/refs/symbolic.py
+++ b/git/refs/symbolic.py
@@ -1,15 +1,15 @@
import os
from git.objects import Object, Commit
from git.util import (
- join_path,
- join_path_native,
+ join_path,
+ join_path_native,
to_native_path_linux,
assure_directory_exists
)
from gitdb.exc import BadObject
from gitdb.util import (
- join,
+ join,
dirname,
isdir,
exists,
@@ -27,7 +27,7 @@ __all__ = ["SymbolicReference"]
class SymbolicReference(object):
"""Represents a special case of a reference such that this reference is symbolic.
- It does not point to a specific commit, but to another Head, which itself
+ It does not point to a specific commit, but to another Head, which itself
specifies a commit.
A typical example for a symbolic reference is HEAD."""
@@ -63,7 +63,7 @@ class SymbolicReference(object):
def name(self):
"""
:return:
- In case of symbolic references, the shortest assumable name
+ In case of symbolic references, the shortest assumable name
is the path itself."""
return self.path
@@ -101,10 +101,10 @@ class SymbolicReference(object):
# END for each line
except (OSError, IOError):
raise StopIteration
- # END no packed-refs file handling
- # NOTE: Had try-finally block around here to close the fp,
+ # END no packed-refs file handling
+ # NOTE: Had try-finally block around here to close the fp,
# but some python version woudn't allow yields within that.
- # I believe files are closing themselves on destruction, so it is
+ # I believe files are closing themselves on destruction, so it is
# alright.
@classmethod
@@ -121,8 +121,8 @@ class SymbolicReference(object):
@classmethod
def _get_ref_info(cls, repo, ref_path):
- """Return: (sha, target_ref_path) if available, the sha the file at
- rela_path points to, or None. target_ref_path is the reference we
+ """Return: (sha, target_ref_path) if available, the sha the file at
+ rela_path points to, or None. target_ref_path is the reference we
point to, or None"""
tokens = None
try:
@@ -156,7 +156,7 @@ class SymbolicReference(object):
def _get_object(self):
"""
:return:
- The object our ref currently refers to. Refs can be cached, they will
+ The object our ref currently refers to. Refs can be cached, they will
always point to the actual object as it gets re-created on each query"""
# have to be dynamic here as we may be a tag which can point to anything
# Our path will be resolved to the hexsha which will be used accordingly
@@ -165,7 +165,7 @@ class SymbolicReference(object):
def _get_commit(self):
"""
:return:
- Commit object we point to, works for detached and non-detached
+ Commit object we point to, works for detached and non-detached
SymbolicReferences. The symbolic reference will be dereferenced recursively."""
obj = self._get_object()
if obj.type == 'tag':
@@ -180,7 +180,7 @@ class SymbolicReference(object):
def set_commit(self, commit, logmsg=None):
"""As set_object, but restricts the type of object to be a Commit
- :raise ValueError: If commit is not a Commit object or doesn't point to
+ :raise ValueError: If commit is not a Commit object or doesn't point to
a commit
:return: self"""
# check the type - assume the best if it is a base-string
@@ -212,7 +212,7 @@ class SymbolicReference(object):
:param object: a refspec, a SymbolicReference or an Object instance. SymbolicReferences
will be dereferenced beforehand to obtain the object they point to
- :param logmsg: If not None, the message will be used in the reflog entry to be
+ :param logmsg: If not None, the message will be used in the reflog entry to be
written. Otherwise the reflog is not altered
:note: plain SymbolicReferences may not actually point to objects by convention
:return: self"""
@@ -247,8 +247,8 @@ class SymbolicReference(object):
def set_reference(self, ref, logmsg=None):
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
- Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
- will be set which effectively detaches the refererence if it was a purely
+ Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
+ will be set which effectively detaches the refererence if it was a purely
symbolic one.
:param ref: SymbolicReference instance, Object instance or refspec string
@@ -261,7 +261,7 @@ class SymbolicReference(object):
See also: log_append()
:return: self
- :note: This symbolic reference will not be dereferenced. For that, see
+ :note: This symbolic reference will not be dereferenced. For that, see
``set_object(...)``"""
write_value = None
obj = None
@@ -317,7 +317,7 @@ class SymbolicReference(object):
def is_valid(self):
"""
:return:
- True if the reference is valid, hence it can be read and points to
+ True if the reference is valid, hence it can be read and points to
a valid object or reference."""
try:
self.object
@@ -355,15 +355,15 @@ class SymbolicReference(object):
:param newbinsha: The sha the ref points to now. If None, our current commit sha
will be used
:return: added RefLogEntry instance"""
- return RefLog.append_entry(self.repo.config_reader(), RefLog.path(self), oldbinsha,
- (newbinsha is None and self.commit.binsha) or newbinsha,
- message)
+ return RefLog.append_entry(self.repo.config_reader(), RefLog.path(self), oldbinsha,
+ (newbinsha is None and self.commit.binsha) or newbinsha,
+ message)
def log_entry(self, index):
""":return: RefLogEntry at the given index
:param index: python list compatible positive or negative index
- .. note:: This method must read part of the reflog during execution, hence
+ .. note:: This method must read part of the reflog during execution, hence
it should be used sparringly, or only if you need just one index.
In that case, it will be faster than the ``log()`` method"""
return RefLog.entry_at(RefLog.path(self), index)
@@ -371,7 +371,7 @@ class SymbolicReference(object):
@classmethod
def to_full_path(cls, path):
"""
- :return: string with a full repository-relative path which can be used to initialize
+ :return: string with a full repository-relative path which can be used to initialize
a Reference instance, for instance by using ``Reference.from_path``"""
if isinstance(path, SymbolicReference):
path = path.path
@@ -409,9 +409,9 @@ class SymbolicReference(object):
made_change = False
dropped_last_line = False
for line in reader:
- # keep line if it is a comment or if the ref to delete is not
+ # keep line if it is a comment or if the ref to delete is not
# in the line
- # If we deleted the last line and this one is a tag-reference object,
+ # If we deleted the last line and this one is a tag-reference object,
# we drop it as well
if ( line.startswith('#') or full_ref_path not in line ) and \
(not dropped_last_line or dropped_last_line and not line.startswith('^')):
@@ -444,8 +444,8 @@ class SymbolicReference(object):
@classmethod
def _create(cls, repo, path, resolve, reference, force, logmsg=None):
"""internal method used to create a new symbolic reference.
- If resolve is False, the reference will be taken as is, creating
- a proper symbolic reference. Otherwise it will be resolved to the
+ If resolve is False, the reference will be taken as is, creating
+ a proper symbolic reference. Otherwise it will be resolved to the
corresponding object and a detached symbolic reference will be created
instead"""
full_ref_path = cls.to_full_path(path)
@@ -462,7 +462,7 @@ class SymbolicReference(object):
target_data = target.path
if not resolve:
target_data = "ref: " + target_data
- existing_data = open(abs_ref_path, 'rb').read().strip()
+ existing_data = open(abs_ref_path, 'rb').read().strip()
if existing_data != target_data:
raise OSError("Reference at %r does already exist, pointing to %r, requested was %r" % (full_ref_path, existing_data, target_data))
# END no force handling
@@ -476,10 +476,10 @@ class SymbolicReference(object):
"""Create a new symbolic reference, hence a reference pointing to another reference.
:param repo:
- Repository to create the reference in
+ Repository to create the reference in
:param path:
- full path at which the new symbolic reference is supposed to be
+ full path at which the new symbolic reference is supposed to be
created at, i.e. "NEW_HEAD" or "symrefs/my_new_symref"
:param reference:
@@ -528,7 +528,7 @@ class SymbolicReference(object):
# if they point to the same file, its not an error
if open(new_abs_path, 'rb').read().strip() != open(cur_abs_path, 'rb').read().strip():
raise OSError("File at path %r already exists" % new_abs_path)
- # else: we could remove ourselves and use the otherone, but
+ # else: we could remove ourselves and use the otherone, but
# but clarity we just continue as usual
# END not force handling
os.remove(new_abs_path)
@@ -551,7 +551,7 @@ class SymbolicReference(object):
rela_paths = set()
# walk loose refs
- # Currently we do not follow links
+ # Currently we do not follow links
for root, dirs, files in os.walk(join_path_native(repo.git_dir, common_path)):
if 'refs/' not in root: # skip non-refs subfolders
refs_id = [d for d in dirs if d == 'refs']
@@ -589,7 +589,7 @@ class SymbolicReference(object):
:param common_path:
Optional keyword argument to the path which is to be shared by all
returned Ref objects.
- Defaults to class specific portion if None assuring that only
+ Defaults to class specific portion if None assuring that only
refs suitable for the actual class are returned.
:return:
diff --git a/git/refs/tag.py b/git/refs/tag.py
index ff32224a..50d2b2af 100644
--- a/git/refs/tag.py
+++ b/git/refs/tag.py
@@ -5,8 +5,8 @@ __all__ = ["TagReference", "Tag"]
class TagReference(Reference):
- """Class representing a lightweight tag reference which either points to a commit
- ,a tag object or any other object. In the latter case additional information,
+ """Class representing a lightweight tag reference which either points to a commit
+ ,a tag object or any other object. In the latter case additional information,
like the signature or the tag-creator, is available.
This tag object will always point to a commit object, but may carray additional
@@ -30,12 +30,12 @@ class TagReference(Reference):
# it is a tag object which carries the commit as an object - we can point to anything
return obj.object
else:
- raise ValueError("Tag %s points to a Blob or Tree - have never seen that before" % self)
+ raise ValueError("Tag %s points to a Blob or Tree - have never seen that before" % self)
@property
def tag(self):
"""
- :return: Tag object this tag ref points to or None in case
+ :return: Tag object this tag ref points to or None in case
we are a light weight tag"""
obj = self.object
if obj.type == "tag":
@@ -51,15 +51,15 @@ class TagReference(Reference):
"""Create a new tag reference.
:param path:
- The name of the tag, i.e. 1.0 or releases/1.0.
+ The name of the tag, i.e. 1.0 or releases/1.0.
The prefix refs/tags is implied
:param ref:
- A reference to the object you want to tag. It can be a commit, tree or
+ A reference to the object you want to tag. It can be a commit, tree or
blob.
:param message:
- If not None, the message will be used in your tag object. This will also
+ If not None, the message will be used in your tag object. This will also
create an additional tag object that allows to obtain that information, i.e.::
tagref.tag.message
diff --git a/git/remote.py b/git/remote.py
index a9dcb3cb..c1fc8078 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -20,7 +20,7 @@ from git.util import (
from refs import (
Reference,
RemoteReference,
- SymbolicReference,
+ SymbolicReference,
TagReference
)
@@ -43,7 +43,7 @@ def digest_process_messages(fh, progress):
"""Read progress messages from file-like object fh, supplying the respective
progress messages to the progress instance.
- :param fh: File handle to read from
+ :param fh: File handle to read from
:return: list(line, ...) list of lines without linebreaks that did
not contain progress information"""
line_so_far = ''
@@ -64,8 +64,8 @@ def digest_process_messages(fh, progress):
def add_progress(kwargs, git, progress):
- """Add the --progress flag to the given kwargs dict if supported by the
- git command. If the actual progress in the given progress instance is not
+ """Add the --progress flag to the given kwargs dict if supported by the
+ git command. If the actual progress in the given progress instance is not
given, we do not request any progress
:return: possibly altered kwargs"""
if progress is not None:
@@ -89,7 +89,7 @@ class PushInfo(object):
info.local_ref # Reference pointing to the local reference that was pushed
# It is None if the ref was deleted.
info.remote_ref_string # path to the remote reference located on the remote side
- info.remote_ref # Remote Reference on the local side corresponding to
+ info.remote_ref # Remote Reference on the local side corresponding to
# the remote_ref_string. It can be a TagReference as well.
info.old_commit # commit at which the remote_ref was standing before we pushed
# it to local_ref.commit. Will be None if an error was indicated
@@ -101,10 +101,10 @@ class PushInfo(object):
FORCED_UPDATE, FAST_FORWARD, UP_TO_DATE, ERROR = [1 << x for x in range(11)]
_flag_map = {'X': NO_MATCH, '-': DELETED, '*': 0,
- '+': FORCED_UPDATE, ' ': FAST_FORWARD,
+ '+': FORCED_UPDATE, ' ': FAST_FORWARD,
'=': UP_TO_DATE, '!': ERROR}
- def __init__(self, flags, local_ref, remote_ref_string, remote, old_commit=None,
+ def __init__(self, flags, local_ref, remote_ref_string, remote, old_commit=None,
summary=''):
""" Initialize a new instance """
self.flags = flags
@@ -118,7 +118,7 @@ class PushInfo(object):
def remote_ref(self):
"""
:return:
- Remote Reference or TagReference in the local repository corresponding
+ Remote Reference or TagReference in the local repository corresponding
to the remote_ref_string kept in this instance."""
# translate heads to a local remote, tags stay as they are
if self.remote_ref_string.startswith("refs/tags"):
@@ -128,7 +128,7 @@ class PushInfo(object):
return RemoteReference(self._remote.repo, "refs/remotes/%s/%s" % (str(self._remote), remote_ref.name))
else:
raise ValueError("Could not handle remote ref: %r" % self.remote_ref_string)
- # END
+ # END
@classmethod
def _from_line(cls, remote, line):
@@ -141,7 +141,7 @@ class PushInfo(object):
try:
flags |= cls._flag_map[control_character]
except KeyError:
- raise ValueError("Control Character %r unknown as parsed from line %r" % (control_character, line))
+ raise ValueError("Control Character %r unknown as parsed from line %r" % (control_character, line))
# END handle control character
# from_to handling
@@ -168,7 +168,7 @@ class PushInfo(object):
flags |= cls.NEW_HEAD
# uptodate encoded in control character
else:
- # fast-forward or forced update - was encoded in control character,
+ # fast-forward or forced update - was encoded in control character,
# but we parse the old and new commit
split_token = "..."
if control_character == " ":
@@ -187,13 +187,13 @@ class FetchInfo(object):
Carries information about the results of a fetch operation of a single head::
info = remote.fetch()[0]
- info.ref # Symbolic Reference or RemoteReference to the changed
+ info.ref # Symbolic Reference or RemoteReference to the changed
# remote head or FETCH_HEAD
- info.flags # additional flags to be & with enumeration members,
- # i.e. info.flags & info.REJECTED
+ info.flags # additional flags to be & with enumeration members,
+ # i.e. info.flags & info.REJECTED
# is 0 if ref is SymbolicReference
info.note # additional notes given by git-fetch intended for the user
- info.old_commit # if info.flags & info.FORCED_UPDATE|info.FAST_FORWARD,
+ info.old_commit # if info.flags & info.FORCED_UPDATE|info.FAST_FORWARD,
# field is set to the previous location of ref, otherwise None
"""
__slots__ = ('ref', 'old_commit', 'flags', 'note')
@@ -205,7 +205,7 @@ class FetchInfo(object):
re_fetch_result = re.compile("^\s*(.) (\[?[\w\s\.]+\]?)\s+(.+) -> ([/\w_\+\.-]+)( \(.*\)?$)?")
_flag_map = {'!': ERROR, '+': FORCED_UPDATE, '-': TAG_UPDATE, '*': 0,
- '=': HEAD_UPTODATE, ' ': FAST_FORWARD}
+ '=': HEAD_UPTODATE, ' ': FAST_FORWARD}
def __init__(self, ref, flags, note='', old_commit=None):
"""
@@ -260,9 +260,9 @@ class FetchInfo(object):
raise ValueError("Failed to parse FETCH__HEAD line: %r" % fetch_line)
# handle FETCH_HEAD and figure out ref type
- # If we do not specify a target branch like master:refs/remotes/origin/master,
+ # If we do not specify a target branch like master:refs/remotes/origin/master,
# the fetch result is stored in FETCH_HEAD which destroys the rule we usually
- # have. In that case we use a symbolic reference which is detached
+ # have. In that case we use a symbolic reference which is detached
ref_type = None
if remote_local_ref == "FETCH_HEAD":
ref_type = SymbolicReference
@@ -278,7 +278,7 @@ class FetchInfo(object):
# create ref instance
if ref_type is SymbolicReference:
- remote_local_ref = ref_type(repo, "FETCH_HEAD")
+ remote_local_ref = ref_type(repo, "FETCH_HEAD")
else:
# determine prefix. Tags are usually pulled into refs/tags, they may have subdirectories.
# It is not clear sometimes where exactly the item is, unless we have an absolute path as indicated
@@ -301,10 +301,10 @@ class FetchInfo(object):
ref_path = join_path(ref_type._common_path_default, remote_local_ref)
#END obtain refpath
- # even though the path could be within the git conventions, we make
+ # even though the path could be within the git conventions, we make
# sure we respect whatever the user wanted, and disabled path checking
remote_local_ref = ref_type(repo, ref_path, check_path=False)
- # END create ref instance
+ # END create ref instance
note = (note and note.strip()) or ''
@@ -314,7 +314,7 @@ class FetchInfo(object):
flags |= cls._flag_map[control_character]
except KeyError:
raise ValueError("Control character %r unknown as parsed from line %r" % (control_character, line))
- # END control char exception hanlding
+ # END control char exception hanlding
# parse operation string for more info - makes no sense for symbolic refs
old_commit = None
@@ -340,7 +340,7 @@ class Remote(LazyMixin, Iterable):
"""Provides easy read and write access to a git remote.
- Everything not part of this interface is considered an option for the current
+ Everything not part of this interface is considered an option for the current
remote, allowing constructs like remote.pushurl to query the pushurl.
NOTE: When querying configuration, the configuration accessor will be cached
@@ -361,14 +361,14 @@ class Remote(LazyMixin, Iterable):
# some oddity: on windows, python 2.5, it for some reason does not realize
# that it has the config_writer property, but instead calls __getattr__
# which will not yield the expected results. 'pinging' the members
- # with a dir call creates the config_writer property that we require
+ # with a dir call creates the config_writer property that we require
# ... bugs like these make me wonder wheter python really wants to be used
# for production. It doesn't happen on linux though.
dir(self)
# END windows special handling
def __getattr__(self, attr):
- """Allows to call this instance like
+ """Allows to call this instance like
remote.special( *args, **kwargs) to call git-remote special self.name"""
if attr == "_config_reader":
return super(Remote, self).__getattr__(attr)
@@ -391,7 +391,7 @@ class Remote(LazyMixin, Iterable):
super(Remote, self)._set_cache_(attr)
def __str__(self):
- return self.name
+ return self.name
def __repr__(self):
return '<git.%s "%s">' % (self.__class__.__name__, self.name)
@@ -422,7 +422,7 @@ class Remote(LazyMixin, Iterable):
def refs(self):
"""
:return:
- IterableList of RemoteReference objects. It is prefixed, allowing
+ IterableList of RemoteReference objects. It is prefixed, allowing
you to omit the remote path portion, i.e.::
remote.refs.master # yields RemoteReference('/refs/remotes/origin/master')"""
out_refs = IterableList(RemoteReference._id_attribute_, "%s/" % self.name)
@@ -434,22 +434,22 @@ class Remote(LazyMixin, Iterable):
def stale_refs(self):
"""
:return:
- IterableList RemoteReference objects that do not have a corresponding
- head in the remote reference anymore as they have been deleted on the
+ IterableList RemoteReference objects that do not have a corresponding
+ head in the remote reference anymore as they have been deleted on the
remote side, but are still available locally.
The IterableList is prefixed, hence the 'origin' must be omitted. See
'refs' property for an example."""
out_refs = IterableList(RemoteReference._id_attribute_, "%s/" % self.name)
for line in self.repo.git.remote("prune", "--dry-run", self).splitlines()[2:]:
- # expecting
+ # expecting
# * [would prune] origin/new_branch
- token = " * [would prune] "
+ token = " * [would prune] "
if not line.startswith(token):
raise ValueError("Could not parse git-remote prune result: %r" % line)
fqhn = "%s/%s" % (RemoteReference._common_path_default, line.replace(token, ""))
out_refs.append(RemoteReference(self.repo, fqhn))
- # END for each line
+ # END for each line
return out_refs
@classmethod
@@ -494,7 +494,7 @@ class Remote(LazyMixin, Iterable):
return self
def update(self, **kwargs):
- """Fetch all changes for this remote, including new branches which will
+ """Fetch all changes for this remote, including new branches which will
be forced in ( in case your local remote branch is not part the new remote branches
ancestry anymore ).
@@ -526,17 +526,17 @@ class Remote(LazyMixin, Iterable):
fetch_info_lines.append(line)
# END for each line
- # read head information
+ # read head information
fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'r')
fetch_head_info = fp.readlines()
fp.close()
# NOTE: HACK Just disabling this line will make github repositories work much better.
- # I simply couldn't stand it anymore, so here is the quick and dirty fix ... .
+ # I simply couldn't stand it anymore, so here is the quick and dirty fix ... .
# This project needs a lot of work !
# assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines)
- output.extend(FetchInfo._from_line(self.repo, err_line, fetch_line)
+ output.extend(FetchInfo._from_line(self.repo, err_line, fetch_line)
for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))
finalize_process(proc)
@@ -556,7 +556,7 @@ class Remote(LazyMixin, Iterable):
except ValueError:
# if an error happens, additional info is given which we cannot parse
pass
- # END exception handling
+ # END exception handling
# END for each line
finalize_process(proc)
@@ -566,13 +566,13 @@ class Remote(LazyMixin, Iterable):
"""Fetch the latest changes for this remote
:param refspec:
- A "refspec" is used by fetch and push to describe the mapping
- between remote ref and local ref. They are combined with a colon in
- the format <src>:<dst>, preceded by an optional plus sign, +.
- For example: git fetch $URL refs/heads/master:refs/heads/origin means
- "grab the master branch head from the $URL and store it as my origin
- branch head". And git push $URL refs/heads/master:refs/heads/to-upstream
- means "publish my master branch head as to-upstream branch at $URL".
+ A "refspec" is used by fetch and push to describe the mapping
+ between remote ref and local ref. They are combined with a colon in
+ the format <src>:<dst>, preceded by an optional plus sign, +.
+ For example: git fetch $URL refs/heads/master:refs/heads/origin means
+ "grab the master branch head from the $URL and store it as my origin
+ branch head". And git push $URL refs/heads/master:refs/heads/to-upstream
+ means "publish my master branch head as to-upstream branch at $URL".
See also git-push(1).
Taken from the git manual
@@ -583,11 +583,11 @@ class Remote(LazyMixin, Iterable):
:param progress: See 'push' method
:param kwargs: Additional arguments to be passed to git-fetch
:return:
- IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
+ IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
information about the fetch results
:note:
- As fetch does not provide progress information to non-ttys, we cannot make
+ As fetch does not provide progress information to non-ttys, we cannot make
it available here unfortunately as in the 'push' method."""
kwargs = add_progress(kwargs, self.repo.git, progress)
if isinstance(refspec, list):
@@ -598,7 +598,7 @@ class Remote(LazyMixin, Iterable):
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
def pull(self, refspec=None, progress=None, **kwargs):
- """Pull changes from the given branch, being the same as a fetch followed
+ """Pull changes from the given branch, being the same as a fetch followed
by a merge of branch with your local branch.
:param refspec: see 'fetch' method
@@ -614,14 +614,14 @@ class Remote(LazyMixin, Iterable):
:param refspec: see 'fetch' method
:param progress:
- Instance of type RemoteProgress allowing the caller to receive
+ Instance of type RemoteProgress allowing the caller to receive
progress information until the method returns.
If None, progress information will be discarded
:param kwargs: Additional arguments to be passed to git-push
:return:
- IterableList(PushInfo, ...) iterable list of PushInfo instances, each
- one informing about an individual head which had been updated on the remote
+ IterableList(PushInfo, ...) iterable list of PushInfo instances, each
+ one informing about an individual head which had been updated on the remote
side.
If the push contains rejected heads, these will have the PushInfo.ERROR bit set
in their flags.
@@ -644,11 +644,11 @@ class Remote(LazyMixin, Iterable):
"""
:return: GitConfigParser compatible object able to write options for this remote.
:note:
- You can only own one writer at a time - delete it to release the
+ You can only own one writer at a time - delete it to release the
configuration file and make it useable by others.
- To assure consistent results, you should only query options through the
- writer. Once you are done writing, you are free to use the config reader
+ To assure consistent results, you should only query options through the
+ writer. Once you are done writing, you are free to use the config reader
once again."""
writer = self.repo.config_writer()
diff --git a/git/repo/base.py b/git/repo/base.py
index 6e9ab5d3..a5bbaa64 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -21,7 +21,7 @@ from git.remote import (
)
from git.db import (
- GitCmdObjectDB,
+ GitCmdObjectDB,
GitDB
)
@@ -53,13 +53,13 @@ __all__ = ('Repo', )
class Repo(object):
- """Represents a git repository and allows you to query references,
+ """Represents a git repository and allows you to query references,
gather commit information, generate diffs, create and clone repositories query
the log.
The following attributes are worth using:
- 'working_dir' is the working directory of the git command, which is the working tree
+ 'working_dir' is the working directory of the git command, which is the working tree
directory if available or the .git directory in case of bare repositories
'working_tree_dir' is the working tree directory, but will raise AssertionError
@@ -90,7 +90,7 @@ class Repo(object):
repo = Repo("~/Development/git-python.git")
repo = Repo("$REPOSITORIES/Development/git-python.git")
- :param odbt: Object DataBase type - a type which is constructed by providing
+ :param odbt: Object DataBase type - a type which is constructed by providing
the directory containing the database objects, i.e. .git/objects. It will
be used to access all object data
:raise InvalidGitRepositoryError:
@@ -127,12 +127,12 @@ class Repo(object):
self._bare = False
try:
- self._bare = self.config_reader("repository").getboolean('core', 'bare')
+ self._bare = self.config_reader("repository").getboolean('core', 'bare')
except Exception:
# lets not assume the option exists, although it should
pass
- # adjust the wd in case we are actually bare - we didn't know that
+ # adjust the wd in case we are actually bare - we didn't know that
# in the first place
if self._bare:
self._working_tree_dir = None
@@ -240,7 +240,7 @@ class Repo(object):
return Submodule.list_items(self)
def submodule(self, name):
- """ :return: Submodule with the given name
+ """ :return: Submodule with the given name
:raise ValueError: If no such submodule exists"""
try:
return self.submodules[name]
@@ -251,7 +251,7 @@ class Repo(object):
def create_submodule(self, *args, **kwargs):
"""Create a new submodule
- :note: See the documentation of Submodule.add for a description of the
+ :note: See the documentation of Submodule.add for a description of the
applicable parameters
:return: created submodules"""
return Submodule.add(self, *args, **kwargs)
@@ -263,7 +263,7 @@ class Repo(object):
return RootModule(self).traverse(*args, **kwargs)
def submodule_update(self, *args, **kwargs):
- """Update the submodules, keeping the repository consistent as it will
+ """Update the submodules, keeping the repository consistent as it will
take the previous state into consideration. For more information, please
see the documentation of RootModule.update"""
return RootModule(self).update(*args, **kwargs)
@@ -282,7 +282,7 @@ class Repo(object):
return TagReference(self, path)
def create_head(self, path, commit='HEAD', force=False, logmsg=None):
- """Create a new head within the repository.
+ """Create a new head within the repository.
For more documentation, please see the Head.create method.
:return: newly created Head Reference"""
@@ -308,8 +308,8 @@ class Repo(object):
def create_remote(self, name, url, **kwargs):
"""Create a new remote.
- For more information, please see the documentation of the Remote.create
- methods
+ For more information, please see the documentation of the Remote.create
+ methods
:return: Remote reference"""
return Remote.create(self, name, url, **kwargs)
@@ -319,7 +319,7 @@ class Repo(object):
return Remote.remove(self, remote)
def _get_config_path(self, config_level):
- # we do not support an absolute path of the gitconfig on windows ,
+ # we do not support an absolute path of the gitconfig on windows ,
# use the global config instead
if sys.platform == "win32" and config_level == "system":
config_level = "global"
@@ -338,15 +338,15 @@ class Repo(object):
:return:
GitConfigParser allowing to read the full git configuration, but not to write it
- The configuration will include values from the system, user and repository
+ The configuration will include values from the system, user and repository
configuration files.
:param config_level:
For possible values, see config_writer method
- If None, all applicable levels will be used. Specify a level in case
- you know which exact file you whish to read to prevent reading multiple files for
+ If None, all applicable levels will be used. Specify a level in case
+ you know which exact file you whish to read to prevent reading multiple files for
instance
- :note: On windows, system configuration cannot currently be read as the path is
+ :note: On windows, system configuration cannot currently be read as the path is
unknown, instead the global path will be used."""
files = None
if config_level is None:
@@ -359,7 +359,7 @@ class Repo(object):
"""
:return:
GitConfigParser allowing to write values of the specified configuration file level.
- Config writers should be retrieved, used to change the configuration ,and written
+ Config writers should be retrieved, used to change the configuration ,and written
right away as they will lock the configuration file in question and prevent other's
to write it.
@@ -395,7 +395,7 @@ class Repo(object):
:note:
If you need a non-root level tree, find it by iterating the root tree. Otherwise
- it cannot know about its path relative to the repository root and subsequent
+ it cannot know about its path relative to the repository root and subsequent
operations might have unexpected results."""
if rev is None:
return self.head.commit.tree
@@ -414,10 +414,10 @@ class Repo(object):
Commits that do not contain that path or the paths will not be returned.
:parm kwargs:
- Arguments to be passed to git-rev-list - common ones are
+ Arguments to be passed to git-rev-list - common ones are
max_count and skip
- :note: to receive only commits between two named revisions, use the
+ :note: to receive only commits between two named revisions, use the
"revA..revB" revision specifier
:return ``git.Commit[]``"""
@@ -463,14 +463,14 @@ class Repo(object):
"""Sets the alternates
:parm alts:
- is the array of string paths representing the alternates at which
+ is the array of string paths representing the alternates at which
git should look for objects, i.e. /home/user/repo/.git/objects
:raise NoSuchPathError:
:note:
The method does not check for the existance of the paths in alts
as the caller is responsible."""
- alternates_path = join(self.git_dir, 'objects', 'info', 'alternates')
+ alternates_path = join(self.git_dir, 'objects', 'info', 'alternates')
if not alts:
if isfile(alternates_path):
os.remove(alternates_path)
@@ -480,7 +480,7 @@ class Repo(object):
f.write("\n".join(alts))
finally:
f.close()
- # END file handling
+ # END file handling
# END alts handling
alternates = property(_get_alternates, _set_alternates, doc="Retrieve a list of alternates paths or set a list paths to be used as alternates")
@@ -489,7 +489,7 @@ class Repo(object):
"""
:return:
``True``, the repository is considered dirty. By default it will react
- like a git-status without untracked files, hence it is dirty if the
+ like a git-status without untracked files, hence it is dirty if the
index or the working copy have changes."""
if self._bare:
# Bare repositories with no associated working directory are
@@ -498,7 +498,7 @@ class Repo(object):
# start from the one which is fastest to evaluate
default_args = ('--abbrev=40', '--full-index', '--raw')
- if index:
+ if index:
# diff index against HEAD
if isfile(self.index.path) and \
len(self.git.diff('--cached', *default_args)):
@@ -557,7 +557,7 @@ class Repo(object):
:parm rev: revision specifier, see git-rev-parse for viable options.
:return:
list: [git.Commit, list: [<line>]]
- A list of tuples associating a Commit object with a list of lines that
+ A list of tuples associating a Commit object with a list of lines that
changed within the given commit. The Commit objects will be given in order
of appearance."""
data = self.git.blame(rev, '--', file, p=True)
@@ -569,7 +569,7 @@ class Repo(object):
parts = self.re_whitespace.split(line, 1)
firstpart = parts[0]
if self.re_hexsha_only.search(firstpart):
- # handles
+ # handles
# 634396b2f541a9f2d58b00be1a07f0c358b999b3 1 1 7 - indicates blame-data start
# 634396b2f541a9f2d58b00be1a07f0c358b999b3 2 2 - indicates another line of blame with the same data
digits = parts[-1].split(" ")
@@ -583,7 +583,7 @@ class Repo(object):
else:
m = self.re_author_committer_start.search(firstpart)
if m:
- # handles:
+ # handles:
# author Tom Preston-Werner
# author-mail <tom@mojombo.com>
# author-time 1192271832
@@ -639,12 +639,12 @@ class Repo(object):
:param path:
is the full path to the repo (traditionally ends with /<name>.git)
- or None in which case the repository will be created in the current
+ or None in which case the repository will be created in the current
working directory
:parm mkdir:
if specified will create the repository directory if it doesn't
- already exists. Creates the directory with a mode=0755.
+ already exists. Creates the directory with a mode=0755.
Only effective if a path is explicitly given
:parm kwargs:
@@ -662,7 +662,7 @@ class Repo(object):
@classmethod
def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
- # special handling for windows for path at which the clone should be
+ # special handling for windows for path at which the clone should be
# created.
# tilde '~' will be expanded to the HOME no matter where the ~ occours. Hence
# we at least give a proper error instead of letting git fail
@@ -673,8 +673,8 @@ class Repo(object):
if '~' in path:
raise OSError("Git cannot handle the ~ character in path %r correctly" % path)
- # on windows, git will think paths like c: are relative and prepend the
- # current working dir ( before it fails ). We temporarily adjust the working
+ # on windows, git will think paths like c: are relative and prepend the
+ # current working dir ( before it fails ). We temporarily adjust the working
# dir to make this actually work
match = re.match("(\w:[/\\\])(.*)", path)
if match:
@@ -684,8 +684,8 @@ class Repo(object):
os.chdir(drive)
path = rest_of_path
kwargs['with_keep_cwd'] = True
- # END cwd preparation
- # END windows handling
+ # END cwd preparation
+ # END windows handling
try:
proc = git.clone(url, path, with_extended_output=True, as_process=True, v=True, **add_progress(kwargs, git, progress))
@@ -700,15 +700,15 @@ class Repo(object):
# END reset previous working dir
# END bad windows handling
- # our git command could have a different working dir than our actual
+ # our git command could have a different working dir than our actual
# environment, hence we prepend its working dir if required
if not os.path.isabs(path) and git.working_dir:
path = join(git._working_dir, path)
- # adjust remotes - there may be operating systems which use backslashes,
+ # adjust remotes - there may be operating systems which use backslashes,
# These might be given as initial paths, but when handling the config file
# that contains the remote from which we were clones, git stops liking it
- # as it will escape the backslashes. Hence we undo the escaping just to be
+ # as it will escape the backslashes. Hence we undo the escaping just to be
# sure
repo = cls(os.path.abspath(path), odbt=odbt)
if repo.remotes:
@@ -749,7 +749,7 @@ class Repo(object):
:parm prefix: is the optional prefix to prepend to each filename in the archive
:parm kwargs:
Additional arguments passed to git-archive
- NOTE: Use the 'format' argument to define the kind of format. Use
+ NOTE: Use the 'format' argument to define the kind of format. Use
specialized ostreams to write any format supported by python
:raise GitCommandError: in case something went wrong
@@ -757,7 +757,7 @@ class Repo(object):
if treeish is None:
treeish = self.head.commit
if prefix and 'prefix' not in kwargs:
- kwargs['prefix'] = prefix
+ kwargs['prefix'] = prefix
kwargs['output_stream'] = ostream
self.git.archive(treeish, **kwargs)
diff --git a/git/repo/fun.py b/git/repo/fun.py
index 1e131b0f..9dfc00ea 100644
--- a/git/repo/fun.py
+++ b/git/repo/fun.py
@@ -5,10 +5,10 @@ from git.refs import SymbolicReference
from git.objects import Object
from gitdb.util import (
join,
- isdir,
+ isdir,
isfile,
dirname,
- hex_to_bin,
+ hex_to_bin,
bin_to_hex
)
from string import digits
@@ -76,7 +76,7 @@ def name_to_object(repo, name, return_ref=False):
# END handle short shas
#END find sha if it matches
- # if we couldn't find an object for what seemed to be a short hexsha
+ # if we couldn't find an object for what seemed to be a short hexsha
# try to find it as reference anyway, it could be named 'aaa' for instance
if hexsha is None:
for base in ('%s', 'refs/%s', 'refs/tags/%s', 'refs/heads/%s', 'refs/remotes/%s', 'refs/remotes/%s/HEAD'):
@@ -184,7 +184,7 @@ def rev_parse(repo, rev):
raise ValueError("Missing closing brace to define type in %s" % rev)
output_type = rev[start + 1:end] # exclude brace
- # handle type
+ # handle type
if output_type == 'commit':
pass # default
elif output_type == 'tree':
@@ -252,7 +252,7 @@ def rev_parse(repo, rev):
# END number parse loop
# no explicit number given, 1 is the default
- # It could be 0 though
+ # It could be 0 though
if not found_digit:
num = 1
# END set default num
diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py
index ec3eef96..351901dc 100644
--- a/git/test/lib/asserts.py
+++ b/git/test/lib/asserts.py
@@ -10,7 +10,7 @@ from nose import tools
from nose.tools import *
import stat
-__all__ = ['assert_instance_of', 'assert_not_instance_of',
+__all__ = ['assert_instance_of', 'assert_not_instance_of',
'assert_none', 'assert_not_none',
'assert_match', 'assert_not_match', 'assert_mode_644',
'assert_mode_755'] + tools.__all__
@@ -48,7 +48,7 @@ def assert_not_match(pattern, string, msg=None):
def assert_mode_644(mode):
"""Verify given mode is 644"""
- assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP)
+ assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP)
assert (mode & stat.S_IWUSR) and (mode & stat.S_IRUSR) and not (mode & stat.S_IXUSR)
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 812aecdc..913cf3b6 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -36,7 +36,7 @@ def absolute_project_path():
#} END routines
-#{ Adapters
+#{ Adapters
class StringProcessAdapter(object):
@@ -55,7 +55,7 @@ class StringProcessAdapter(object):
#} END adapters
-#{ Decorators
+#{ Decorators
def _mktemp(*args):
@@ -68,7 +68,7 @@ def _mktemp(*args):
def _rmtree_onerror(osremove, fullpath, exec_info):
"""
- Handle the case on windows that read-only files cannot be deleted by
+ Handle the case on windows that read-only files cannot be deleted by
os.remove by setting it to mode 777, then retry deletion.
"""
if os.name != 'nt' or osremove is not os.remove:
@@ -80,12 +80,12 @@ def _rmtree_onerror(osremove, fullpath, exec_info):
def with_rw_repo(working_tree_ref, bare=False):
"""
- Same as with_bare_repo, but clones the rorepo as non-bare repository, checking
+ Same as with_bare_repo, but clones the rorepo as non-bare repository, checking
out the working tree at the given working_tree_ref.
This repository type is more costly due to the working copy checkout.
- To make working with relative paths easier, the cwd will be set to the working
+ To make working with relative paths easier, the cwd will be set to the working
dir of the repository.
"""
assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout"
@@ -130,14 +130,14 @@ def with_rw_repo(working_tree_ref, bare=False):
def with_rw_and_rw_remote_repo(working_tree_ref):
"""
Same as with_rw_repo, but also provides a writable remote repository from which the
- rw_repo has been forked as well as a handle for a git-daemon that may be started to
+ rw_repo has been forked as well as a handle for a git-daemon that may be started to
run the remote_repo.
- The remote repository was cloned as bare repository from the rorepo, wheras
+ The remote repository was cloned as bare repository from the rorepo, wheras
the rw repo has a working tree and was cloned from the remote repository.
- remote_repo has two remotes: origin and daemon_origin. One uses a local url,
- the other uses a server url. The daemon setup must be done on system level
- and should be an inetd service that serves tempdir.gettempdir() and all
+ remote_repo has two remotes: origin and daemon_origin. One uses a local url,
+ the other uses a server url. The daemon setup must be done on system level
+ and should be an inetd service that serves tempdir.gettempdir() and all
directories in it.
The following scetch demonstrates this::
@@ -176,7 +176,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
# release lock
del(crw)
- # initialize the remote - first do it as local remote and pull, then
+ # initialize the remote - first do it as local remote and pull, then
# we change the url to point to the daemon. The daemon should be started
# by the user, not by us
d_remote = Remote.create(rw_repo, "daemon_origin", remote_repo_dir)
@@ -191,7 +191,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
except GitCommandError, e:
print str(e)
if os.name == 'nt':
- raise AssertionError('git-daemon needs to run this test, but windows does not have one. Otherwise, run: git-daemon "%s"' % os.path.dirname(_mktemp()))
+ raise AssertionError('git-daemon needs to run this test, but windows does not have one. Otherwise, run: git-daemon "%s"' % os.path.dirname(_mktemp()))
else:
raise AssertionError('Please start a git-daemon to run this test, execute: git-daemon "%s"' % os.path.dirname(_mktemp()))
# END make assertion
@@ -229,20 +229,20 @@ class TestBase(TestCase):
self.fail("todo")
self.failUnlessRaises(...)
- - Class level repository which is considered read-only as it is shared among
+ - Class level repository which is considered read-only as it is shared among
all test cases in your type.
- Access it using::
+ Access it using::
self.rorepo # 'ro' stands for read-only
- The rorepo is in fact your current project's git repo. If you refer to specific
- shas for your objects, be sure you choose some that are part of the immutable portion
+ The rorepo is in fact your current project's git repo. If you refer to specific
+ shas for your objects, be sure you choose some that are part of the immutable portion
of the project history ( to assure tests don't fail for others ).
"""
@classmethod
def setUpClass(cls):
"""
- Dynamically add a read-only repository to our actual type. This way
+ Dynamically add a read-only repository to our actual type. This way
each test type has its own repository
"""
cls.rorepo = Repo(GIT_REPO)
diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py
index 28500da4..00d41b76 100644
--- a/git/test/performance/lib.py
+++ b/git/test/performance/lib.py
@@ -30,11 +30,11 @@ def resolve_or_fail(env_var):
#} END utilities
-#{ Base Classes
+#{ Base Classes
class TestBigRepoR(TestBase):
- """TestCase providing access to readonly 'big' repositories using the following
+ """TestCase providing access to readonly 'big' repositories using the following
member variables:
* gitrorepo
@@ -49,7 +49,7 @@ class TestBigRepoR(TestBase):
#{ Invariants
head_sha_2k = '235d521da60e4699e5bd59ac658b5b48bd76ddca'
head_sha_50 = '32347c375250fd470973a5d76185cac718955fd5'
- #} END invariants
+ #} END invariants
@classmethod
def setUp(cls):
diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py
index adee2567..009b3d82 100644
--- a/git/test/performance/test_commit.py
+++ b/git/test/performance/test_commit.py
@@ -32,8 +32,8 @@ class TestPerformance(TestBigRepoRW):
no = 0
nc = 0
- # find the first commit containing the given path - always do a full
- # iteration ( restricted to the path in question ), but in fact it should
+ # find the first commit containing the given path - always do a full
+ # iteration ( restricted to the path in question ), but in fact it should
# return quite a lot of commits, we just take one and hence abort the operation
st = time()
@@ -46,7 +46,7 @@ class TestPerformance(TestBigRepoRW):
# END for each object
# END for each commit
elapsed_time = time() - st
- print >> sys.stderr, "Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )" % (nc, no, elapsed_time, no / elapsed_time)
+ print >> sys.stderr, "Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )" % (nc, no, elapsed_time, no / elapsed_time)
def test_commit_traversal(self):
# bound to cat-file parsing performance
@@ -83,9 +83,9 @@ class TestPerformance(TestBigRepoRW):
nc = 5000
st = time()
for i in xrange(nc):
- cm = Commit(rwrepo, Commit.NULL_BIN_SHA, hc.tree,
- hc.author, hc.authored_date, hc.author_tz_offset,
- hc.committer, hc.committed_date, hc.committer_tz_offset,
+ cm = Commit(rwrepo, Commit.NULL_BIN_SHA, hc.tree,
+ hc.author, hc.authored_date, hc.author_tz_offset,
+ hc.committer, hc.committed_date, hc.committer_tz_offset,
str(i), parents=hc.parents, encoding=hc.encoding)
stream = StringIO()
diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py
index 32ae98bf..e42867a3 100644
--- a/git/test/performance/test_streams.py
+++ b/git/test/performance/test_streams.py
@@ -36,7 +36,7 @@ class TestObjDBPerformance(TestBigRepoR):
elapsed = time() - st
print >> sys.stderr, "Done (in %f s)" % elapsed
- # writing - due to the compression it will seem faster than it is
+ # writing - due to the compression it will seem faster than it is
st = time()
binsha = ldb.store(IStream('blob', size, stream)).binsha
elapsed_add = time() - st
@@ -79,7 +79,7 @@ class TestObjDBPerformance(TestBigRepoR):
# del db file so git has something to do
os.remove(db_file)
- # VS. CGIT
+ # VS. CGIT
##########
# CGIT ! Can using the cgit programs be faster ?
proc = rwrepo.git.hash_object('-w', '--stdin', as_process=True, istream=subprocess.PIPE)
@@ -99,7 +99,7 @@ class TestObjDBPerformance(TestBigRepoR):
fsize_kib = os.path.getsize(db_file) / 1000
print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to using git-hash-object in %f s ( %f Write KiB / s)" % (size_kib, fsize_kib, desc, gelapsed_add, size_kib / gelapsed_add)
- # compare ...
+ # compare ...
print >> sys.stderr, "Git-Python is %f %% faster than git when adding big %s files" % (100.0 - (elapsed_add / gelapsed_add) * 100, desc)
# read all
@@ -108,7 +108,7 @@ class TestObjDBPerformance(TestBigRepoR):
gelapsed_readall = time() - st
print >> sys.stderr, "Read %i KiB of %s data at once using git-cat-file in %f s ( %f Read KiB / s)" % (size_kib, desc, gelapsed_readall, size_kib / gelapsed_readall)
- # compare
+ # compare
print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %sfiles" % (100.0 - (elapsed_readall / gelapsed_readall) * 100, desc)
# read chunks
@@ -122,6 +122,6 @@ class TestObjDBPerformance(TestBigRepoR):
gelapsed_readchunks = time() - st
print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from git-cat-file in %f s ( %f Read KiB / s)" % (size_kib, desc, cs_kib, gelapsed_readchunks, size_kib / gelapsed_readchunks)
- # compare
+ # compare
print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %s files in chunks" % (100.0 - (elapsed_readchunks / gelapsed_readchunks) * 100, desc)
# END for each randomization factor
diff --git a/git/test/performance/test_utils.py b/git/test/performance/test_utils.py
index 19c37a5f..c8d397fb 100644
--- a/git/test/performance/test_utils.py
+++ b/git/test/performance/test_utils.py
@@ -60,7 +60,7 @@ class TestUtilPerformance(TestBigRepoR):
elapsed = time() - st
na = ni * 3
print >> sys.stderr, "Accessed %s[x] %i times in %s s ( %f acc / s)" % (cls.__name__, na, elapsed, na / elapsed)
- # END for each sequence
+ # END for each sequence
def test_instantiation(self):
ni = 100000
@@ -138,7 +138,7 @@ class TestUtilPerformance(TestBigRepoR):
yield i
# END slow iter - be closer to the real world
- # alloc doesn't play a role here it seems
+ # alloc doesn't play a role here it seems
for ni in (500, 1000, 10000, 20000, 40000):
st = time()
for i in list(xrange(ni)):
diff --git a/git/test/test_base.py b/git/test/test_base.py
index 211c7479..81e785ab 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -18,12 +18,12 @@ import tempfile
class TestBase(TestBase):
- type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"),
+ type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"),
("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"),
("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None),
- ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None))
+ ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None))
- def test_base_object(self):
+ def test_base_object(self):
# test interface of base object classes
types = (Blob, Tree, Commit, TagObject)
assert len(types) == len(self.type_tuples)
@@ -76,7 +76,7 @@ class TestBase(TestBase):
def test_get_object_type_by_name(self):
for tname in base.Object.TYPES:
assert base.Object in get_object_type_by_name(tname).mro()
- # END for each known type
+ # END for each known type
assert_raises(ValueError, get_object_type_by_name, "doesntexist")
diff --git a/git/test/test_commit.py b/git/test/test_commit.py
index e211f75b..6cd892f0 100644
--- a/git/test/test_commit.py
+++ b/git/test/test_commit.py
@@ -17,7 +17,7 @@ import re
def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False):
- """traverse all commits in the history of commit identified by commit_id and check
+ """traverse all commits in the history of commit identified by commit_id and check
if the serialization works.
:param print_performance_info: if True, we will show how fast we are"""
ns = 0 # num serializations
@@ -27,7 +27,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
for cm in rwrepo.commit(commit_id).traverse():
nds += 1
- # assert that we deserialize commits correctly, hence we get the same
+ # assert that we deserialize commits correctly, hence we get the same
# sha on serialization
stream = StringIO()
cm._serialize(stream)
@@ -39,8 +39,8 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
assert istream.hexsha == cm.hexsha
nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree,
- cm.author, cm.authored_date, cm.author_tz_offset,
- cm.committer, cm.committed_date, cm.committer_tz_offset,
+ cm.author, cm.authored_date, cm.author_tz_offset,
+ cm.committer, cm.committed_date, cm.committer_tz_offset,
cm.message, cm.parents, cm.encoding)
assert nc.parents == cm.parents
@@ -90,11 +90,11 @@ class TestCommit(TestBase):
assert isinstance(d, dict)
for key in ("insertions", "deletions", "lines"):
assert key in d
- # END assertion helper
- assert stats.files
+ # END assertion helper
+ assert stats.files
assert stats.total
- check_entries(stats.total)
+ check_entries(stats.total)
assert "files" in stats.total
for filepath, d in stats.files.items():
@@ -147,7 +147,7 @@ class TestCommit(TestBase):
# ignore self
assert start.traverse(ignore_self=False).next() == start
- # depth
+ # depth
assert len(list(start.traverse(ignore_self=False, depth=0))) == 1
# prune
@@ -159,7 +159,7 @@ class TestCommit(TestBase):
# traversal should stop when the beginning is reached
self.failUnlessRaises(StopIteration, first.traverse().next)
- # parents of the first commit should be empty ( as the only parent has a null
+ # parents of the first commit should be empty ( as the only parent has a null
# sha )
assert len(first.parents) == 0
@@ -233,7 +233,7 @@ class TestCommit(TestBase):
first_parent = piter.next()
assert first_parent != c
assert first_parent == c.parents[0]
- # END for each
+ # END for each
def test_base(self):
name_rev = self.rorepo.head.commit.name_rev
diff --git a/git/test/test_config.py b/git/test/test_config.py
index de4727e0..b6888023 100644
--- a/git/test/test_config.py
+++ b/git/test/test_config.py
@@ -91,7 +91,7 @@ class TestBase(TestCase):
self.failUnlessRaises(IOError, r_config.remove_option, section, option)
# END for each option
self.failUnlessRaises(IOError, r_config.remove_section, section)
- # END for each section
+ # END for each section
assert num_sections and num_options
assert r_config._is_initialized == True
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index aacd9368..151a3d14 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -48,8 +48,8 @@ class TestDiff(TestBase):
def test_diff_patch_format(self):
# test all of the 'old' format diffs for completness - it should at least
# be able to deal with it
- fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only",
- "diff_new_mode", "diff_numstat", "diff_p", "diff_rename",
+ fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only",
+ "diff_new_mode", "diff_numstat", "diff_p", "diff_rename",
"diff_tree_numstat_root")
for fixture_name in fixtures:
@@ -77,7 +77,7 @@ class TestDiff(TestBase):
for ct in DiffIndex.change_type:
key = 'ct_%s' % ct
assertion_map.setdefault(key, 0)
- assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct)))
+ assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct)))
# END for each changetype
# check entries
@@ -87,18 +87,18 @@ class TestDiff(TestBase):
assert len(diff_set) == 1
assert diff_index[0] == diff_index[0]
assert not (diff_index[0] != diff_index[0])
- # END diff index checking
+ # END diff index checking
# END for each patch option
# END for each path option
# END for each other side
# END for each commit
- # assert we could always find at least one instance of the members we
+ # assert we could always find at least one instance of the members we
# can iterate in the diff index - if not this indicates its not working correctly
# or our test does not span the whole range of possibilities
for key, value in assertion_map.items():
assert value, "Did not find diff for %s" % key
- # END for each iteration type
+ # END for each iteration type
# test path not existing in the index - should be ignored
c = self.rorepo.head.commit
diff --git a/git/test/test_fun.py b/git/test/test_fun.py
index 9d6f3ea4..4672901c 100644
--- a/git/test/test_fun.py
+++ b/git/test/test_fun.py
@@ -1,7 +1,7 @@
from git.test.lib import *
from git.objects.fun import (
traverse_tree_recursive,
- traverse_trees_recursive,
+ traverse_trees_recursive,
tree_to_stream,
tree_entries_from_data
)
@@ -15,7 +15,7 @@ from gitdb.base import IStream
from gitdb.typ import str_tree_type
from stat import (
- S_IFDIR,
+ S_IFDIR,
S_IFREG,
S_IFLNK
)
@@ -37,7 +37,7 @@ class TestFun(TestBase):
def test_aggressive_tree_merge(self):
# head tree with additions, removals and modification compared to its predecessor
odb = self.rorepo.odb
- HC = self.rorepo.commit("6c1faef799095f3990e9970bc2cb10aa0221cf9c")
+ HC = self.rorepo.commit("6c1faef799095f3990e9970bc2cb10aa0221cf9c")
H = HC.tree
B = HC.parents[0].tree
diff --git a/git/test/test_git.py b/git/test/test_git.py
index e8a4c6b3..49c256ca 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -6,7 +6,7 @@
import os
from git.test.lib import (TestBase,
- patch,
+ patch,
raises,
assert_equal,
assert_true,
diff --git a/git/test/test_index.py b/git/test/test_index.py
index f5c92099..f1f718cd 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -38,7 +38,7 @@ class TestIndex(TestBase):
self._fprogress_map[path] = curval + 1
def _fprogress_add(self, path, done, item):
- """Called as progress func - we keep track of the proper
+ """Called as progress func - we keep track of the proper
call order"""
assert item is not None
self._fprogress(path, done, item)
@@ -109,7 +109,7 @@ class TestIndex(TestBase):
cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573"
other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9"
- # simple index from tree
+ # simple index from tree
base_index = IndexFile.from_tree(rw_repo, common_ancestor_sha)
assert base_index.entries
self._cmp_tree_index(common_ancestor_sha, base_index)
@@ -133,7 +133,7 @@ class TestIndex(TestBase):
# test BlobFilter
prefix = 'lib/git'
for stage, blob in base_index.iter_blobs(BlobFilter([prefix])):
- assert blob.path.startswith(prefix)
+ assert blob.path.startswith(prefix)
# writing a tree should fail with an unmerged index
self.failUnlessRaises(UnmergedEntriesError, three_way_index.write_tree)
@@ -155,7 +155,7 @@ class TestIndex(TestBase):
@with_rw_repo('0.1.6')
def test_index_merge_tree(self, rw_repo):
- # A bit out of place, but we need a different repo for this:
+ # A bit out of place, but we need a different repo for this:
assert self.rorepo != rw_repo and not (self.rorepo == rw_repo)
assert len(set((self.rorepo, self.rorepo, rw_repo, rw_repo))) == 2
@@ -174,18 +174,18 @@ class TestIndex(TestBase):
# FAKE MERGE
#############
- # Add a change with a NULL sha that should conflict with next_commit. We
- # pretend there was a change, but we do not even bother adding a proper
+ # Add a change with a NULL sha that should conflict with next_commit. We
+ # pretend there was a change, but we do not even bother adding a proper
# sha for it ( which makes things faster of course )
manifest_fake_entry = BaseIndexEntry((manifest_entry[0], "\0" * 20, 0, manifest_entry[3]))
# try write flag
self._assert_entries(rw_repo.index.add([manifest_fake_entry], write=False))
- # add actually resolves the null-hex-sha for us as a feature, but we can
+ # add actually resolves the null-hex-sha for us as a feature, but we can
# edit the index manually
assert rw_repo.index.entries[manifest_key].binsha != Object.NULL_BIN_SHA
- # must operate on the same index for this ! Its a bit problematic as
+ # must operate on the same index for this ! Its a bit problematic as
# it might confuse people
- index = rw_repo.index
+ index = rw_repo.index
index.entries[manifest_key] = IndexEntry.from_base(manifest_fake_entry)
index.write()
assert rw_repo.index.entries[manifest_key].hexsha == Diff.NULL_HEX_SHA
@@ -193,12 +193,12 @@ class TestIndex(TestBase):
# write an unchanged index ( just for the fun of it )
rw_repo.index.write()
- # a three way merge would result in a conflict and fails as the command will
- # not overwrite any entries in our index and hence leave them unmerged. This is
+ # a three way merge would result in a conflict and fails as the command will
+ # not overwrite any entries in our index and hence leave them unmerged. This is
# mainly a protection feature as the current index is not yet in a tree
self.failUnlessRaises(GitCommandError, index.merge_tree, next_commit, base=parent_commit)
- # the only way to get the merged entries is to safe the current index away into a tree,
+ # the only way to get the merged entries is to safe the current index away into a tree,
# which is like a temporary commit for us. This fails as well as the NULL sha deos not
# have a corresponding object
# NOTE: missing_ok is not a kwarg anymore, missing_ok is always true
@@ -225,7 +225,7 @@ class TestIndex(TestBase):
# could sha it, or check stats
# test diff
- # resetting the head will leave the index in a different state, and the
+ # resetting the head will leave the index in a different state, and the
# diff will yield a few changes
cur_head_commit = rw_repo.head.reference.commit
ref = rw_repo.head.reset('HEAD~6', index=True, working_tree=False)
@@ -354,14 +354,14 @@ class TestIndex(TestBase):
uname = "Some Developer"
umail = "sd@company.com"
rw_repo.config_writer().set_value("user", "name", uname)
- rw_repo.config_writer().set_value("user", "email", umail)
+ rw_repo.config_writer().set_value("user", "email", umail)
- # remove all of the files, provide a wild mix of paths, BaseIndexEntries,
+ # remove all of the files, provide a wild mix of paths, BaseIndexEntries,
# IndexEntries
def mixed_iterator():
count = 0
for entry in index.entries.itervalues():
- type_id = count % 4
+ type_id = count % 4
if type_id == 0: # path
yield entry.path
elif type_id == 1: # blob
@@ -373,7 +373,7 @@ class TestIndex(TestBase):
else:
raise AssertionError("Invalid Type")
count += 1
- # END for each entry
+ # END for each entry
# END mixed iterator
deleted_files = index.remove(mixed_iterator(), working_tree=False)
assert deleted_files
@@ -446,13 +446,13 @@ class TestIndex(TestBase):
self._assert_fprogress(entries)
assert len(entries) > 1
- # glob
+ # glob
entries = index.reset(new_commit).add([os.path.join('lib', 'git', '*.py')], fprogress=self._fprogress_add)
self._assert_entries(entries)
self._assert_fprogress(entries)
assert len(entries) == 14
- # same file
+ # same file
entries = index.reset(new_commit).add([os.path.abspath(os.path.join('lib', 'git', 'head.py'))] * 2, fprogress=self._fprogress_add)
self._assert_entries(entries)
assert entries[0].mode & 0644 == 0644
@@ -469,7 +469,7 @@ class TestIndex(TestBase):
entries = index.reset(new_commit).add([old_blob], fprogress=self._fprogress_add)
self._assert_entries(entries)
self._assert_fprogress(entries)
- assert index.entries[(old_blob.path, 0)].hexsha == old_blob.hexsha and len(entries) == 1
+ assert index.entries[(old_blob.path, 0)].hexsha == old_blob.hexsha and len(entries) == 1
# mode 0 not allowed
null_hex_sha = Diff.NULL_HEX_SHA
@@ -498,7 +498,7 @@ class TestIndex(TestBase):
# we expect only the target to be written
assert index.repo.odb.stream(entries[0].binsha).read() == target
- # END real symlink test
+ # END real symlink test
# add fake symlink and assure it checks-our as symlink
fake_symlink_relapath = "my_fake_symlink"
@@ -535,9 +535,9 @@ class TestIndex(TestBase):
# on windows we will never get symlinks
if os.name == 'nt':
- # simlinks should contain the link as text ( which is what a
+ # simlinks should contain the link as text ( which is what a
# symlink actually is )
- open(fake_symlink_path, 'rb').read() == link_target
+ open(fake_symlink_path, 'rb').read() == link_target
else:
assert S_ISLNK(os.lstat(fake_symlink_path)[ST_MODE])
@@ -553,7 +553,7 @@ class TestIndex(TestBase):
files = ['AUTHORS', 'LICENSE']
self.failUnlessRaises(GitCommandError, index.move, files)
- # again, with force
+ # again, with force
assert_mv_rval(index.move(files, f=True))
# files into directory - dry run
@@ -632,7 +632,7 @@ class TestIndex(TestBase):
index.reset(working_tree=True, paths=files)
- for fkey in keys:
+ for fkey in keys:
assert fkey in index.entries
for absfile in absfiles:
assert os.path.isfile(absfile)
@@ -650,7 +650,7 @@ class TestIndex(TestBase):
index = rw_repo.index.reset(commit)
orig_tree = commit.tree
assert index.write_tree() == orig_tree
- # END for each commit
+ # END for each commit
def test_index_new(self):
B = self.rorepo.tree("6d9b1f4f9fa8c9f030e3207e7deacc5d5f8bba4e")
diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py
index a68b25a3..fec50095 100644
--- a/git/test/test_reflog.py
+++ b/git/test/test_reflog.py
@@ -35,7 +35,7 @@ class TestRefLog(TestBase):
tdir = tempfile.mktemp(suffix="test_reflogs")
os.mkdir(tdir)
- rlp_master_ro = RefLog.path(self.rorepo.head)
+ rlp_master_ro = RefLog.path(self.rorepo.head)
assert os.path.isfile(rlp_master_ro)
# simple read
@@ -94,7 +94,7 @@ class TestRefLog(TestBase):
for idx in (-1, -24):
RefLog.entry_at(rlp, idx)
#END for each index to read
- # END for each reflog
+ # END for each reflog
# finally remove our temporary data
shutil.rmtree(tdir)
diff --git a/git/test/test_refs.py b/git/test/test_refs.py
index f4f8b9d8..ee9d8074 100644
--- a/git/test/test_refs.py
+++ b/git/test/test_refs.py
@@ -23,7 +23,7 @@ class TestRefs(TestBase):
full_path = ref_type.to_full_path(name)
instance = ref_type.from_path(self.rorepo, full_path)
assert isinstance(instance, ref_type)
- # END for each name
+ # END for each name
# END for each type
# invalid path
@@ -42,7 +42,7 @@ class TestRefs(TestBase):
tagobj = tag.tag
# have no dict
self.failUnlessRaises(AttributeError, setattr, tagobj, 'someattr', 1)
- assert isinstance(tagobj, TagObject)
+ assert isinstance(tagobj, TagObject)
assert tagobj.tag == tag.name
assert isinstance(tagobj.tagger, Actor)
assert isinstance(tagobj.tagged_date, int)
@@ -152,7 +152,7 @@ class TestRefs(TestBase):
types_found = set()
for ref in self.rorepo.refs:
types_found.add(type(ref))
- assert len(types_found) >= 3
+ assert len(types_found) >= 3
def test_is_valid(self):
assert Reference(self.rorepo, 'refs/doesnt/exist').is_valid() == False
@@ -187,7 +187,7 @@ class TestRefs(TestBase):
cur_head.reset(new_head_commit)
rw_repo.index.checkout(["lib"], force=True)
- # now that we have a write write repo, change the HEAD reference - its
+ # now that we have a write write repo, change the HEAD reference - its
# like git-reset --soft
heads = rw_repo.heads
assert heads
@@ -212,7 +212,7 @@ class TestRefs(TestBase):
cur_head.reference = some_tag
assert not cur_head.is_detached
assert cur_head.commit == some_tag.commit
- assert isinstance(cur_head.reference, TagReference)
+ assert isinstance(cur_head.reference, TagReference)
# put HEAD back to a real head, otherwise everything else fails
cur_head.reference = active_head
@@ -220,7 +220,7 @@ class TestRefs(TestBase):
# type check
self.failUnlessRaises(ValueError, setattr, cur_head, "reference", "that")
- # head handling
+ # head handling
commit = 'HEAD'
prev_head_commit = cur_head.commit
for count, new_name in enumerate(("my_new_head", "feature/feature1")):
@@ -286,7 +286,7 @@ class TestRefs(TestBase):
# remote deletion
remote_refs_so_far = 0
- remotes = rw_repo.remotes
+ remotes = rw_repo.remotes
assert remotes
for remote in remotes:
refs = remote.refs
@@ -330,7 +330,7 @@ class TestRefs(TestBase):
head.object = head_tree
assert head.object == head_tree
# cannot query tree as commit
- self.failUnlessRaises(TypeError, getattr, head, 'commit')
+ self.failUnlessRaises(TypeError, getattr, head, 'commit')
# set the commit directly using the head. This would never detach the head
assert not cur_head.is_detached
@@ -422,7 +422,7 @@ class TestRefs(TestBase):
assert symref.reference == cur_head.reference
self.failUnlessRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference.commit)
- # it works if the new ref points to the same reference
+ # it works if the new ref points to the same reference
SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path
SymbolicReference.delete(rw_repo, symref)
# would raise if the symref wouldn't have been deletedpbl
@@ -467,7 +467,7 @@ class TestRefs(TestBase):
assert not symref.is_detached
# when iterating references, we can get references and symrefs
- # when deleting all refs, I'd expect them to be gone ! Even from
+ # when deleting all refs, I'd expect them to be gone ! Even from
# the packed ones
# For this to work, we must not be on any branch
rw_repo.head.reference = rw_repo.head.commit
@@ -485,7 +485,7 @@ class TestRefs(TestBase):
assert ref not in deleted_refs
# END for each ref
- # reattach head - head will not be returned if it is not a symbolic
+ # reattach head - head will not be returned if it is not a symbolic
# ref
rw_repo.head.reference = Head.create(rw_repo, "master")
@@ -496,7 +496,7 @@ class TestRefs(TestBase):
# test creation of new refs from scratch
for path in ("basename", "dir/somename", "dir2/subdir/basename"):
- # REFERENCES
+ # REFERENCES
############
fpath = Reference.to_full_path(path)
ref_fp = Reference.from_path(rw_repo, fpath)
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index 638349ba..a5a73ce1 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -12,7 +12,7 @@ import shutil
import os
import random
-# assure we have repeatable results
+# assure we have repeatable results
random.seed(0)
@@ -84,13 +84,13 @@ class TestRemote(TestBase):
assert isinstance(info.note, basestring)
if isinstance(info.ref, Reference):
assert info.flags != 0
- # END reference type flags handling
+ # END reference type flags handling
assert isinstance(info.ref, (SymbolicReference, Reference))
if info.flags & (info.FORCED_UPDATE | info.FAST_FORWARD):
assert isinstance(info.old_commit, Commit)
else:
assert info.old_commit is None
- # END forced update checking
+ # END forced update checking
# END for each info
def _do_test_push_result(self, results, remote):
@@ -108,13 +108,13 @@ class TestRemote(TestBase):
assert has_one
else:
# there must be a remote commit
- if info.flags & info.DELETED == 0:
+ if info.flags & info.DELETED == 0:
assert isinstance(info.local_ref, Reference)
else:
assert info.local_ref is None
assert type(info.remote_ref) in (TagReference, RemoteReference)
# END error checking
- # END for each info
+ # END for each info
def _do_test_fetch_info(self, repo):
self.failUnlessRaises(ValueError, FetchInfo._from_line, repo, "nonsense", '')
@@ -222,7 +222,7 @@ class TestRemote(TestBase):
res = fetch_and_test(remote, tags=True)
self.failUnlessRaises(IndexError, get_info, res, remote, str(rtag))
- # provoke to receive actual objects to see what kind of output we have to
+ # provoke to receive actual objects to see what kind of output we have to
# expect. For that we need a remote transport protocol
# Create a new UN-shared repo and fetch into it after we pushed a change
# to the shared repo
@@ -233,7 +233,7 @@ class TestRemote(TestBase):
remote_repo_url = "git://localhost%s" % remote_repo.git_dir
# put origin to git-url
- other_origin = other_repo.remotes.origin
+ other_origin = other_repo.remotes.origin
other_origin.config_writer.set("url", remote_repo_url)
# it automatically creates alternates as remote_repo is shared as well.
# It will use the transport though and ignore alternates when fetching
@@ -245,8 +245,8 @@ class TestRemote(TestBase):
self._commit_random_file(rw_repo)
remote.push(rw_repo.head.reference)
- # here I would expect to see remote-information about packing
- # objects and so on. Unfortunately, this does not happen
+ # here I would expect to see remote-information about packing
+ # objects and so on. Unfortunately, this does not happen
# if we are redirecting the output - git explicitly checks for this
# and only provides progress information to ttys
res = fetch_and_test(other_origin)
@@ -262,10 +262,10 @@ class TestRemote(TestBase):
try:
lhead.reference = rw_repo.heads.master
except AttributeError:
- # if the author is on a non-master branch, the clones might not have
+ # if the author is on a non-master branch, the clones might not have
# a local master yet. We simply create it
lhead.reference = rw_repo.create_head('master')
- # END master handling
+ # END master handling
lhead.reset(remote.refs.master, working_tree=True)
# push without spec should fail ( without further configuration )
@@ -283,13 +283,13 @@ class TestRemote(TestBase):
# rejected - undo last commit
lhead.reset("HEAD~1")
res = remote.push(lhead.reference)
- assert res[0].flags & PushInfo.ERROR
+ assert res[0].flags & PushInfo.ERROR
assert res[0].flags & PushInfo.REJECTED
self._do_test_push_result(res, remote)
# force rejected pull
res = remote.push('+%s' % lhead.reference)
- assert res[0].flags & PushInfo.ERROR == 0
+ assert res[0].flags & PushInfo.ERROR == 0
assert res[0].flags & PushInfo.FORCED_UPDATE
self._do_test_push_result(res, remote)
@@ -297,7 +297,7 @@ class TestRemote(TestBase):
res = remote.push("hellothere")
assert len(res) == 0
- # push new tags
+ # push new tags
progress = TestRemoteProgress()
to_be_updated = "my_tag.1.0RV"
new_tag = TagReference.create(rw_repo, to_be_updated)
@@ -322,7 +322,7 @@ class TestRemote(TestBase):
res = remote.push(":%s" % new_tag.path)
self._do_test_push_result(res, remote)
assert res[0].flags & PushInfo.DELETED
- # Currently progress is not properly transferred, especially not using
+ # Currently progress is not properly transferred, especially not using
# the git daemon
# progress.assert_received_message()
@@ -346,7 +346,7 @@ class TestRemote(TestBase):
remote.pull('master')
- # cleanup - delete created tags and branches as we are in an innerloop on
+ # cleanup - delete created tags and branches as we are in an innerloop on
# the same repository
TagReference.delete(rw_repo, new_tag, other_tag)
remote.push(":%s" % other_tag.path)
@@ -364,7 +364,7 @@ class TestRemote(TestBase):
remote_set.add(remote)
remote_set.add(remote) # should already exist
- # REFS
+ # REFS
refs = remote.refs
assert refs
for ref in refs:
@@ -392,9 +392,9 @@ class TestRemote(TestBase):
assert writer.get(opt) == val
del(writer)
assert getattr(remote, opt) == val
- # END for each default option key
+ # END for each default option key
- # RENAME
+ # RENAME
other_name = "totally_other_name"
prev_name = remote.name
assert remote.rename(other_name) == remote
@@ -408,12 +408,12 @@ class TestRemote(TestBase):
self._assert_push_and_pull(remote, rw_repo, remote_repo)
# FETCH TESTING
- # Only for remotes - local cases are the same or less complicated
+ # Only for remotes - local cases are the same or less complicated
# as additional progress information will never be emitted
if remote.name == "daemon_origin":
self._do_test_fetch(remote, rw_repo, remote_repo)
ran_fetch_test = True
- # END fetch test
+ # END fetch test
remote.update()
# END for each remote
@@ -449,7 +449,7 @@ class TestRemote(TestBase):
fetch_info_line_fmt = "c437ee5deb8d00cf02f03720693e4c802e99f390 not-for-merge %s '0.3' of git://github.com/gitpython-developers/GitPython"
remote_info_line_fmt = "* [new branch] nomatter -> %s"
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "local/master",
+ remote_info_line_fmt % "local/master",
fetch_info_line_fmt % 'remote-tracking branch')
assert fi.ref.is_valid()
assert fi.ref.commit
@@ -458,7 +458,7 @@ class TestRemote(TestBase):
# or a special path just in refs/something for instance
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "subdir/tagname",
+ remote_info_line_fmt % "subdir/tagname",
fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
@@ -466,7 +466,7 @@ class TestRemote(TestBase):
# it could be in a remote direcftory though
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "remotename/tags/tagname",
+ remote_info_line_fmt % "remotename/tags/tagname",
fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
@@ -475,7 +475,7 @@ class TestRemote(TestBase):
# it can also be anywhere !
tag_path = "refs/something/remotename/tags/tagname"
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % tag_path,
+ remote_info_line_fmt % tag_path,
fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
@@ -483,7 +483,7 @@ class TestRemote(TestBase):
# branches default to refs/remotes
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "remotename/branch",
+ remote_info_line_fmt % "remotename/branch",
fetch_info_line_fmt % 'branch')
assert isinstance(fi.ref, RemoteReference)
@@ -491,7 +491,7 @@ class TestRemote(TestBase):
# but you can force it anywhere, in which case we only have a references
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "refs/something/branch",
+ remote_info_line_fmt % "refs/something/branch",
fetch_info_line_fmt % 'branch')
assert type(fi.ref) is Reference
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index 86d355e6..d6568d0b 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -53,14 +53,14 @@ class TestRepo(TestBase):
for head in self.rorepo.heads:
assert head.name
assert isinstance(head.commit, Commit)
- # END for each head
+ # END for each head
assert isinstance(self.rorepo.heads.master, Head)
assert isinstance(self.rorepo.heads['master'], Head)
def test_tree_from_revision(self):
tree = self.rorepo.tree('0.1.6')
- assert len(tree.hexsha) == 40
+ assert len(tree.hexsha) == 40
assert tree.type == "tree"
assert self.rorepo.tree(tree) == tree
@@ -104,7 +104,7 @@ class TestRepo(TestBase):
assert num_trees == mc
def _assert_empty_repo(self, repo):
- # test all kinds of things with an empty, freshly initialized repo.
+ # test all kinds of things with an empty, freshly initialized repo.
# It should throw good errors
# entries should be empty
@@ -123,7 +123,7 @@ class TestRepo(TestBase):
# is_dirty can handle all kwargs
for args in ((1, 0, 0), (0, 1, 0), (0, 0, 1)):
assert not repo.is_dirty(*args)
- # END for each arg
+ # END for each arg
# we can add a file to the index ( if we are not bare )
if not repo.bare:
@@ -216,7 +216,7 @@ class TestRepo(TestBase):
orig_value = self.rorepo._bare
self.rorepo._bare = True
assert_false(self.rorepo.is_dirty())
- self.rorepo._bare = orig_value
+ self.rorepo._bare = orig_value
def test_is_dirty(self):
self.rorepo._bare = False
@@ -285,7 +285,7 @@ class TestRepo(TestBase):
def test_untracked_files(self):
base = self.rorepo.working_tree_dir
- files = (join_path_native(base, "__test_myfile"),
+ files = (join_path_native(base, "__test_myfile"),
join_path_native(base, "__test_other_file"))
num_recently_untracked = 0
try:
@@ -305,12 +305,12 @@ class TestRepo(TestBase):
for fpath in files:
if os.path.isfile(fpath):
os.remove(fpath)
- # END handle files
+ # END handle files
assert len(self.rorepo.untracked_files) == (num_recently_untracked - len(files))
def test_config_reader(self):
- reader = self.rorepo.config_reader() # all config files
+ reader = self.rorepo.config_reader() # all config files
assert reader.read_only
reader = self.rorepo.config_reader("repository") # single config file
assert reader.read_only
@@ -321,13 +321,13 @@ class TestRepo(TestBase):
writer = self.rorepo.config_writer(config_level)
assert not writer.read_only
except IOError:
- # its okay not to get a writer for some configuration files if we
+ # its okay not to get a writer for some configuration files if we
# have no permissions
- pass
- # END for each config level
+ pass
+ # END for each config level
def test_creation_deletion(self):
- # just a very quick test to assure it generally works. There are
+ # just a very quick test to assure it generally works. There are
# specialized cases in the test_refs module
head = self.rorepo.create_head("new_head", "HEAD~1")
self.rorepo.delete_head(head)
@@ -348,7 +348,7 @@ class TestRepo(TestBase):
# last \n is the terminating newline that it expects
l1 = "0123456789\n"
l2 = "abcdefghijklmnopqrstxy\n"
- l3 = "z\n"
+ l3 = "z\n"
d = "%s%s%s\n" % (l1, l2, l3)
l1p = l1[:5]
@@ -441,7 +441,7 @@ class TestRepo(TestBase):
obj = orig_obj.object
else:
obj = orig_obj
- # END deref tags by default
+ # END deref tags by default
# try history
rev = name + "~"
@@ -496,7 +496,7 @@ class TestRepo(TestBase):
for ref in Reference.iter_items(self.rorepo):
path_tokens = ref.path.split("/")
for pt in range(len(path_tokens)):
- path_section = '/'.join(path_tokens[-(pt + 1):])
+ path_section = '/'.join(path_tokens[-(pt + 1):])
try:
obj = self._assert_rev_parse(path_section)
assert obj.type == ref.object.type
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index 3f7ac39d..0ecb5c1f 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -45,7 +45,7 @@ class TestSubmodule(TestBase):
# manual instantiation
smm = Submodule(rwrepo, "\0" * 20)
# name needs to be set in advance
- self.failUnlessRaises(AttributeError, getattr, smm, 'name')
+ self.failUnlessRaises(AttributeError, getattr, smm, 'name')
# iterate - 1 submodule
sms = Submodule.list_items(rwrepo, self.k_subm_current)
@@ -83,8 +83,8 @@ class TestSubmodule(TestBase):
# test config_reader/writer methods
sm.config_reader()
- new_smclone_path = None # keep custom paths for later
- new_csmclone_path = None #
+ new_smclone_path = None # keep custom paths for later
+ new_csmclone_path = None #
if rwrepo.bare:
self.failUnlessRaises(InvalidGitRepositoryError, sm.config_writer)
else:
@@ -110,7 +110,7 @@ class TestSubmodule(TestBase):
smold.set_parent_commit(self.k_subm_changed + "~1")
assert smold.binsha != sm.binsha
- # raises if the sm didn't exist in new parent - it keeps its
+ # raises if the sm didn't exist in new parent - it keeps its
# parent_commit unchanged
self.failUnlessRaises(ValueError, smold.set_parent_commit, self.k_no_subm_tag)
@@ -214,7 +214,7 @@ class TestSubmodule(TestBase):
repo.head.reset('HEAD~2', working_tree=1)
# END for each repo to reset
- # dry run does nothing
+ # dry run does nothing
sm.update(recursive=True, dry_run=True, progress=prog)
for repo in smods:
assert repo.head.commit != repo.head.ref.tracking_branch().commit
@@ -324,7 +324,7 @@ class TestSubmodule(TestBase):
rwrepo.index.commit("my submod commit")
assert len(rwrepo.submodules) == 2
- # needs update as the head changed, it thinks its in the history
+ # needs update as the head changed, it thinks its in the history
# of the repo otherwise
nsm.set_parent_commit(rwrepo.head.commit)
osm.set_parent_commit(rwrepo.head.commit)
@@ -369,7 +369,7 @@ class TestSubmodule(TestBase):
for remote in osmod.remotes:
remote.remove(osmod, remote.name)
assert not osm.exists()
- self.failUnlessRaises(ValueError, Submodule.add, rwrepo, osmid, csm_repopath, url=None)
+ self.failUnlessRaises(ValueError, Submodule.add, rwrepo, osmid, csm_repopath, url=None)
# END handle bare mode
# Error if there is no submodule file here
@@ -424,7 +424,7 @@ class TestSubmodule(TestBase):
prep = sm.path
assert not sm.module_exists() # was never updated after rwrepo's clone
- # assure we clone from a local source
+ # assure we clone from a local source
sm.config_writer().set_value('url', to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, sm.path)))
# dry-run does nothing
@@ -491,9 +491,9 @@ class TestSubmodule(TestBase):
rm.update(recursive=False)
assert not os.path.isdir(smp)
- # change url
+ # change url
#=============
- # to the first repository, this way we have a fast checkout, and a completely different
+ # to the first repository, this way we have a fast checkout, and a completely different
# repository at the different url
nsm.set_parent_commit(csmremoved)
nsmurl = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsmsp[0]))
@@ -519,7 +519,7 @@ class TestSubmodule(TestBase):
# change branch
#=================
- # we only have one branch, so we switch to a virtual one, and back
+ # we only have one branch, so we switch to a virtual one, and back
# to the current one to trigger the difference
cur_branch = nsm.branch
nsmm = nsm.module()
@@ -552,7 +552,7 @@ class TestSubmodule(TestBase):
assert len(nsm.children()) >= 1 # could include smmap
assert nsm.exists() and nsm.module_exists() and len(nsm.children()) >= 1
# assure we pull locally only
- nsmc = nsm.children()[0]
+ nsmc = nsm.children()[0]
nsmc.config_writer().set_value('url', async_url)
rm.update(recursive=True, progress=prog, dry_run=True) # just to run the code
rm.update(recursive=True, progress=prog)
diff --git a/git/test/test_tree.py b/git/test/test_tree.py
index e3743c2d..0f1fb7c3 100644
--- a/git/test/test_tree.py
+++ b/git/test/test_tree.py
@@ -137,7 +137,7 @@ class TestTree(TestBase):
found_slash = True
# END check for slash
- # slashes in paths are supported as well
+ # slashes in paths are supported as well
assert root[item.path] == item == root / item.path
# END for each item
assert found_slash
diff --git a/git/util.py b/git/util.py
index 180ed907..f6aa34e2 100644
--- a/git/util.py
+++ b/git/util.py
@@ -18,16 +18,16 @@ import getpass
from exc import GitCommandError
from gitdb.util import (
- make_sha,
- LockedFD,
- file_contents_ro,
- LazyMixin,
- to_hex_sha,
+ make_sha,
+ LockedFD,
+ file_contents_ro,
+ LazyMixin,
+ to_hex_sha,
to_bin_sha
)
-__all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
- "join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
+__all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
+ "join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
"BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists',
'RemoteProgress', 'rmtree')
@@ -66,7 +66,7 @@ def stream_copy(source, destination, chunk_size=512 * 1024):
def join_path(a, *p):
- """Join path tokens together similar to os.path.join, but always use
+ """Join path tokens together similar to os.path.join, but always use
'/' instead of possibly '\' on windows."""
path = a
for b in p:
@@ -100,8 +100,8 @@ else:
def join_path_native(a, *p):
"""
- As join path, but makes sure an OS native path is returned. This is only
- needed to play it safe on my dear windows and to assure nice paths that only
+ As join path, but makes sure an OS native path is returned. This is only
+ needed to play it safe on my dear windows and to assure nice paths that only
use '\'"""
return to_native_path(join_path(a, *p))
@@ -114,7 +114,7 @@ def assure_directory_exists(path, is_file=False):
:return: True if the directory was created, False if it already existed"""
if is_file:
path = os.path.dirname(path)
- #END handle file
+ #END handle file
if not os.path.isdir(path):
os.makedirs(path)
return True
@@ -167,19 +167,19 @@ class RemoteProgress(object):
:return: list(line, ...) list of lines that could not be processed"""
# handle
- # Counting objects: 4, done.
+ # Counting objects: 4, done.
# Compressing objects: 50% (1/2) \rCompressing objects: 100% (2/2) \rCompressing objects: 100% (2/2), done.
self._cur_line = line
sub_lines = line.split('\r')
failed_lines = list()
for sline in sub_lines:
- # find esacpe characters and cut them away - regex will not work with
+ # find esacpe characters and cut them away - regex will not work with
# them as they are non-ascii. As git might expect a tty, it will send them
last_valid_index = None
for i, c in enumerate(reversed(sline)):
if ord(c) < 32:
# its a slice index
- last_valid_index = -i - 1
+ last_valid_index = -i - 1
# END character was non-ascii
# END for each character in sline
if last_valid_index is not None:
@@ -214,7 +214,7 @@ class RemoteProgress(object):
op_code |= self.RESOLVING
else:
# Note: On windows it can happen that partial lines are sent
- # Hence we get something like "CompreReceiving objects", which is
+ # Hence we get something like "CompreReceiving objects", which is
# a blend of "Compressing objects" and "Receiving objects".
# This can't really be prevented, so we drop the line verbosely
# to make sure we get informed in case the process spits out new
@@ -257,17 +257,17 @@ class RemoteProgress(object):
:param op_code:
Integer allowing to be compared against Operation IDs and stage IDs.
- Stage IDs are BEGIN and END. BEGIN will only be set once for each Operation
+ Stage IDs are BEGIN and END. BEGIN will only be set once for each Operation
ID as well as END. It may be that BEGIN and END are set at once in case only
one progress message was emitted due to the speed of the operation.
Between BEGIN and END, none of these flags will be set
- Operation IDs are all held within the OP_MASK. Only one Operation ID will
+ Operation IDs are all held within the OP_MASK. Only one Operation ID will
be active per call.
:param cur_count: Current absolute count of items
:param max_count:
- The maximum count of items we expect. It may be None in case there is
+ The maximum count of items we expect. It may be None in case there is
no maximum number of items or if it is (yet) unknown.
:param message:
@@ -280,8 +280,8 @@ class RemoteProgress(object):
class Actor(object):
- """Actors hold information about a person acting on the repository. They
- can be committers and authors or anything with a name and an email as
+ """Actors hold information about a person acting on the repository. They
+ can be committers and authors or anything with a name and an email as
mentioned in the git log entries."""
# PRECOMPILED REGEX
name_only_regex = re.compile(r'<(.+)>')
@@ -347,7 +347,7 @@ class Actor(object):
default_email = get_user_id()
default_name = default_email.split('@')[0]
- for attr, evar, cvar, default in (('name', env_name, cls.conf_name, default_name),
+ for attr, evar, cvar, default in (('name', env_name, cls.conf_name, default_name),
('email', env_email, cls.conf_email, default_email)):
try:
setattr(actor, attr, os.environ[evar])
@@ -365,7 +365,7 @@ class Actor(object):
def committer(cls, config_reader=None):
"""
:return: Actor instance corresponding to the configured committer. It behaves
- similar to the git implementation, such that the environment will override
+ similar to the git implementation, such that the environment will override
configuration values of config_reader. If no value is set at all, it will be
generated
:param config_reader: ConfigReader to use to retrieve the values from in case
@@ -374,7 +374,7 @@ class Actor(object):
@classmethod
def author(cls, config_reader=None):
- """Same as committer(), but defines the main author. It may be specified in the environment,
+ """Same as committer(), but defines the main author. It may be specified in the environment,
but defaults to the committer"""
return cls._main_actor(cls.env_author_name, cls.env_author_email, config_reader)
@@ -382,7 +382,7 @@ class Actor(object):
class Stats(object):
"""
- Represents stat information as presented by git at the end of a merge. It is
+ Represents stat information as presented by git at the end of a merge. It is
created from the output of a diff operation.
``Example``::
@@ -433,7 +433,7 @@ class Stats(object):
class IndexFileSHA1Writer(object):
- """Wrapper around a file-like object that remembers the SHA1 of
+ """Wrapper around a file-like object that remembers the SHA1 of
the data written to it. It will write a sha when the stream is closed
or if the asked for explicitly usign write_sha.
@@ -466,7 +466,7 @@ class IndexFileSHA1Writer(object):
class LockFile(object):
- """Provides methods to obtain, check for, and release a file based lock which
+ """Provides methods to obtain, check for, and release a file based lock which
should be used to handle concurrent access to the same file.
As we are a utility class to be derived from, we only use protected methods.
@@ -498,7 +498,7 @@ class LockFile(object):
:raise IOError: if a lock was already present or a lock file could not be written"""
if self._has_lock():
- return
+ return
lock_file = self._lock_file_path()
if os.path.isfile(lock_file):
raise IOError("Lock for file %r did already exist, delete %r in case the lock is illegal" % (self._file_path, lock_file))
@@ -526,7 +526,7 @@ class LockFile(object):
lfp = self._lock_file_path()
try:
# on bloody windows, the file needs write permissions to be removable.
- # Why ...
+ # Why ...
if os.name == 'nt':
os.chmod(lfp, int("0777", 8))
# END handle win32
@@ -538,11 +538,11 @@ class LockFile(object):
class BlockingLockFile(LockFile):
- """The lock file will block until a lock could be obtained, or fail after
+ """The lock file will block until a lock could be obtained, or fail after
a specified timeout.
- :note: If the directory containing the lock was removed, an exception will
- be raised during the blocking period, preventing hangs as the lock
+ :note: If the directory containing the lock was removed, an exception will
+ be raised during the blocking period, preventing hangs as the lock
can never be obtained."""
__slots__ = ("_check_interval", "_max_block_time")
@@ -559,7 +559,7 @@ class BlockingLockFile(LockFile):
self._max_block_time = max_block_time_s
def _obtain_lock(self):
- """This method blocks until it obtained the lock, or raises IOError if
+ """This method blocks until it obtained the lock, or raises IOError if
it ran out of time or if the parent directory was not available anymore.
If this method returns, you are guranteed to own the lock"""
starttime = time.time()
@@ -596,11 +596,11 @@ class IterableList(list):
heads['master']
heads[0]
- It requires an id_attribute name to be set which will be queried from its
+ It requires an id_attribute name to be set which will be queried from its
contained items to have a means for comparison.
- A prefix can be specified which is to be used in case the id returned by the
- items always contains a prefix that does not matter to the user, so it
+ A prefix can be specified which is to be used in case the id returned by the
+ items always contains a prefix that does not matter to the user, so it
can be left out."""
__slots__ = ('_id_attr', '_prefix')
@@ -664,7 +664,7 @@ class IterableList(list):
class Iterable(object):
- """Defines an interface for iterable items which is to assure a uniform
+ """Defines an interface for iterable items which is to assure a uniform
way to retrieve and iterate items within the git repository"""
__slots__ = tuple()
_id_attribute_ = "attribute that most suitably identifies your instance"
@@ -673,7 +673,7 @@ class Iterable(object):
def list_items(cls, repo, *args, **kwargs):
"""
Find all items of this type - subclasses can specify args and kwargs differently.
- If no args are given, subclasses are obliged to return all items if no additional
+ If no args are given, subclasses are obliged to return all items if no additional
arguments arg given.
:note: Favor the iter_items method as it will