summaryrefslogtreecommitdiff
path: root/git/refs
diff options
context:
space:
mode:
Diffstat (limited to 'git/refs')
-rw-r--r--git/refs/__init__.py17
-rw-r--r--git/refs/head.py3
-rw-r--r--git/refs/log.py4
-rw-r--r--git/refs/reference.py5
-rw-r--r--git/refs/symbolic.py4
5 files changed, 13 insertions, 20 deletions
diff --git a/git/refs/__init__.py b/git/refs/__init__.py
index 3123b991..0281121a 100644
--- a/git/refs/__init__.py
+++ b/git/refs/__init__.py
@@ -1,21 +1,22 @@
+from __future__ import absolute_import
# import all modules in order, fix the names they require
-from symbolic import *
-from reference import *
-from head import *
-from tag import *
-from remote import *
+from .symbolic import *
+from .reference import *
+from .head import *
+from .tag import *
+from .remote import *
# name fixes
-import head
+from . import head
head.RemoteReference = RemoteReference
del(head)
-import symbolic
+from . import symbolic
for item in (HEAD, Head, RemoteReference, TagReference, Reference, SymbolicReference):
setattr(symbolic, item.__name__, item)
del(symbolic)
-from log import *
+from .log import *
diff --git a/git/refs/head.py b/git/refs/head.py
index 6f36a956..acdd37d6 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -210,9 +210,8 @@ class Head(Reference):
By default it is only allowed to checkout heads - everything else
will leave the HEAD detached which is allowed and possible, but remains
a special state that some tools might not be able to handle."""
- args = list()
kwargs['f'] = force
- if kwargs['f'] == False:
+ if kwargs['f'] is False:
kwargs.pop('f')
self.repo.git.checkout(self, **kwargs)
diff --git a/git/refs/log.py b/git/refs/log.py
index 742c9ccd..e3f3363c 100644
--- a/git/refs/log.py
+++ b/git/refs/log.py
@@ -1,5 +1,4 @@
from git.util import (
- join_path,
Actor,
LockedFD,
LockFile,
@@ -16,12 +15,10 @@ from gitdb.util import (
from git.objects.util import (
parse_date,
Serializable,
- utctz_to_altz,
altz_to_utctz_str,
)
import time
-import os
import re
__all__ = ["RefLog", "RefLogEntry"]
@@ -281,7 +278,6 @@ class RefLog(list, Serializable):
#{ Serializable Interface
def _serialize(self, stream):
- lm1 = len(self) - 1
write = stream.write
# write all entries
diff --git a/git/refs/reference.py b/git/refs/reference.py
index f71ded72..b07ac0cd 100644
--- a/git/refs/reference.py
+++ b/git/refs/reference.py
@@ -4,11 +4,6 @@ from git.util import (
Iterable,
)
-from gitdb.util import (
- isfile,
- hex_to_bin
-)
-
__all__ = ["Reference"]
#{ Utilities
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py
index 1e361244..2fa58d12 100644
--- a/git/refs/symbolic.py
+++ b/git/refs/symbolic.py
@@ -424,7 +424,7 @@ class SymbolicReference(object):
# in the line
# 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 \
+ if (line.startswith('#') or full_ref_path not in line) and \
(not dropped_last_line or dropped_last_line and not line.startswith('^')):
new_lines.append(line)
dropped_last_line = False
@@ -623,6 +623,8 @@ class SymbolicReference(object):
if not path:
raise ValueError("Cannot create Reference from %r" % path)
+ # Names like HEAD are inserted after the refs module is imported - we have an import dependency
+ # cycle and don't want to import these names in-function
for ref_type in (HEAD, Head, RemoteReference, TagReference, Reference, SymbolicReference):
try:
instance = ref_type(repo, path)