summaryrefslogtreecommitdiff
path: root/git/index
diff options
context:
space:
mode:
Diffstat (limited to 'git/index')
-rw-r--r--git/index/base.py32
-rw-r--r--git/index/fun.py6
2 files changed, 19 insertions, 19 deletions
diff --git a/git/index/base.py b/git/index/base.py
index e6682d5d..14a3117a 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -119,7 +119,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
ok = True
except OSError:
# in new repositories, there may be no index, which means we are empty
- self.entries = dict()
+ self.entries = {}
return
finally:
if not ok:
@@ -316,7 +316,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
if len(treeish) == 0 or len(treeish) > 3:
raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))
- arg_list = list()
+ arg_list = []
# ignore that working tree and index possibly are out of date
if len(treeish) > 1:
# drop unmerged entries when reading our index and merging
@@ -463,9 +463,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
are at stage 3 will not have a stage 3 entry.
"""
is_unmerged_blob = lambda t: t[0] != 0
- path_map = dict()
+ path_map = {}
for stage, blob in self.iter_blobs(is_unmerged_blob):
- path_map.setdefault(blob.path, list()).append((stage, blob))
+ path_map.setdefault(blob.path, []).append((stage, blob))
# END for each unmerged blob
for l in mviter(path_map):
l.sort()
@@ -568,8 +568,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
def _preprocess_add_items(self, items):
""" Split the items into two lists of path strings and BaseEntries. """
- paths = list()
- entries = list()
+ paths = []
+ entries = []
for item in items:
if isinstance(item, string_types):
@@ -602,7 +602,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
@unbare_repo
@git_working_dir
def _entries_for_paths(self, paths, path_rewriter, fprogress, entries):
- entries_added = list()
+ entries_added = []
if path_rewriter:
for path in paths:
if osp.isabs(path):
@@ -734,7 +734,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# automatically
# paths can be git-added, for everything else we use git-update-index
paths, entries = self._preprocess_add_items(items)
- entries_added = list()
+ entries_added = []
# This code needs a working tree, therefore we try not to run it unless required.
# That way, we are OK on a bare repository as well.
# If there are no paths, the rewriter has nothing to do either
@@ -801,7 +801,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
def _items_to_rela_paths(self, items):
"""Returns a list of repo-relative paths from the given items which
may be absolute or relative paths, entries or blobs"""
- paths = list()
+ paths = []
for item in items:
if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
paths.append(self._to_relative_path(item.path))
@@ -850,7 +850,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
been removed effectively.
This is interesting to know in case you have provided a directory or
globs. Paths are relative to the repository. """
- args = list()
+ args = []
if not working_tree:
args.append("--cached")
args.append("--")
@@ -889,7 +889,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:raise ValueError: If only one item was given
GitCommandError: If git could not handle your request"""
- args = list()
+ args = []
if skip_errors:
args.append('-k')
@@ -902,7 +902,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# first execute rename in dryrun so the command tells us what it actually does
# ( for later output )
- out = list()
+ out = []
mvlines = self.repo.git.mv(args, paths, **kwargs).splitlines()
# parse result - first 0:n/2 lines are 'checking ', the remaining ones
@@ -1033,9 +1033,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# line contents:
stderr = stderr.decode(defenc)
# git-checkout-index: this already exists
- failed_files = list()
- failed_reasons = list()
- unknown_lines = list()
+ failed_files = []
+ failed_reasons = []
+ unknown_lines = []
endings = (' already exists', ' is not in the cache', ' does not exist at stage', ' is unmerged')
for line in stderr.splitlines():
if not line.startswith("git checkout-index: ") and not line.startswith("git-checkout-index: "):
@@ -1098,7 +1098,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
proc = self.repo.git.checkout_index(args, **kwargs)
# FIXME: Reading from GIL!
make_exc = lambda: GitCommandError(("git-checkout-index",) + tuple(args), 128, proc.stderr.read())
- checked_out_files = list()
+ checked_out_files = []
for path in paths:
co_path = to_native_path_linux(self._to_relative_path(path))
diff --git a/git/index/fun.py b/git/index/fun.py
index c01a32b8..c8912dd2 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -187,7 +187,7 @@ def read_cache(stream):
* content_sha is a 20 byte sha on all cache file contents"""
version, num_entries = read_header(stream)
count = 0
- entries = dict()
+ entries = {}
read = stream.read
tell = stream.tell
@@ -236,7 +236,7 @@ def write_tree_from_cache(entries, odb, sl, si=0):
: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
tree entries being a tuple of hexsha, mode, name"""
- tree_items = list()
+ tree_items = []
tree_items_append = tree_items.append
ci = sl.start
end = sl.stop
@@ -295,7 +295,7 @@ def aggressive_tree_merge(odb, tree_shas):
: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
If 3 are given, a 3 way merge is performed"""
- out = list()
+ out = []
out_append = out.append
# one and two way is the same for us, as we don't have to handle an existing