summaryrefslogtreecommitdiff
path: root/refs/reference.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-24 12:30:51 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-24 12:30:51 +0100
commita17c43d0662bab137903075f2cff34bcabc7e1d1 (patch)
treef757e77c85213da7c53d129476430745465935b0 /refs/reference.py
parent8dd51f1d63fa5ee704c2bdf4cb607bb6a71817d2 (diff)
downloadgitpython-a17c43d0662bab137903075f2cff34bcabc7e1d1.tar.gz
Made previously protected methods public to introduce a method with reflog support which cannot be exposed using the respective property. Ref-Creation is now fully implemented in python. For details, see doc/source/changes.rst
Diffstat (limited to 'refs/reference.py')
-rw-r--r--refs/reference.py27
1 files changed, 2 insertions, 25 deletions
diff --git a/refs/reference.py b/refs/reference.py
index a76e2d5d..446196c3 100644
--- a/refs/reference.py
+++ b/refs/reference.py
@@ -18,6 +18,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
"""Represents a named reference to any object. Subclasses may apply restrictions though,
i.e. Heads can only point to commits."""
__slots__ = tuple()
+ _resolve_ref_on_create = True
_common_path_default = "refs"
def __init__(self, repo, path):
@@ -52,7 +53,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
:note:
TypeChecking is done by the git command"""
- abs_path = self._abs_path()
+ abs_path = self.abspath
existed = True
if not isfile(abs_path):
existed = False
@@ -81,31 +82,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
return self.path # could be refs/HEAD
return '/'.join(tokens[2:])
-
@classmethod
- def create(cls, repo, path, commit='HEAD', force=False ):
- """Create a new reference.
-
- :param repo: Repository to create the reference in
- :param path:
- The relative path of the reference, i.e. 'new_branch' or
- feature/feature1. The path prefix 'refs/' is implied if not
- given explicitly
-
- :param commit:
- Commit to which the new reference should point, defaults to the
- current HEAD
-
- :param force:
- if True, force creation even if a reference with that name already exists.
- Raise OSError otherwise
-
- :return: Newly created Reference
-
- :note: This does not alter the current HEAD, index or Working Tree"""
- return cls._create(repo, path, True, commit, force)
-
- @classmethod
def iter_items(cls, repo, common_path = None):
"""Equivalent to SymbolicReference.iter_items, but will return non-detached
references as well."""