From: Catalin Marinas Date: Fri, 6 Jun 2008 20:35:14 +0000 (+0100) Subject: Rename Repository.head to Repository.head_ref X-Git-Tag: v0.15-rc1~214 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/2b8d32ac66a07ca070910d653a48948c87e8f87f?hp=d454cc061c8c401ecc57863cb977a06341d12653 Rename Repository.head to Repository.head_ref This is to avoid confusion with the Stack.head function which returns a commit object rather than a file name. The patch also changes the "new" function to use stack.head directly rather than via the Repository.refs... object. Signed-off-by: Catalin Marinas Acked-by: Karl Hasselström --- diff --git a/stgit/commands/new.py b/stgit/commands/new.py index 15bb2e0..c4ee4e1 100644 --- a/stgit/commands/new.py +++ b/stgit/commands/new.py @@ -58,9 +58,8 @@ def func(parser, options, args): else: parser.error('incorrect number of arguments') - head = directory.repository.refs.get(directory.repository.head) cd = gitlib.CommitData( - tree = head.data.tree, parents = [head], message = '', + tree = stack.head.data.tree, parents = [stack.head], message = '', author = gitlib.Person.author(), committer = gitlib.Person.committer()) # Set patch commit message from commandline. diff --git a/stgit/lib/git.py b/stgit/lib/git.py index c9f01e3..fd66f6d 100644 --- a/stgit/lib/git.py +++ b/stgit/lib/git.py @@ -443,13 +443,13 @@ class Repository(RunWithEnv): ).output_one_line() return self.get_commit(sha1) @property - def head(self): + def head_ref(self): try: return self.run(['git', 'symbolic-ref', '-q', 'HEAD'] ).output_one_line() except run.RunException: raise DetachedHeadException() - def set_head(self, ref, msg): + def set_head_ref(self, ref, msg): self.run(['git', 'symbolic-ref', '-m', msg, 'HEAD', ref]).no_output() def simple_merge(self, base, ours, theirs): """Given three L{Tree}s, tries to do an in-index merge with a diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py index bdd21b1..b1544a5 100644 --- a/stgit/lib/stack.py +++ b/stgit/lib/stack.py @@ -178,7 +178,7 @@ class Repository(git.Repository): self.__stacks = {} # name -> Stack @property def current_branch(self): - return utils.strip_leading('refs/heads/', self.head) + return utils.strip_leading('refs/heads/', self.head_ref) @property def current_stack(self): return self.get_stack()