From: Catalin Marinas <catalin.marinas@gmail.com>
To: git@vger.kernel.org
Cc: "Karl Hasselström" <kha@treskal.com>
Subject: [StGIT PATCH 1/5] Rename Repository.head to Repository.head_ref
Date: Fri, 06 Jun 2008 21:45:37 +0100 [thread overview]
Message-ID: <20080606204537.8805.12051.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080606204322.8805.32313.stgit@localhost.localdomain>
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 <catalin.marinas@gmail.com>
---
stgit/commands/new.py | 3 +--
stgit/lib/git.py | 4 ++--
stgit/lib/stack.py | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
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()
next prev parent reply other threads:[~2008-06-06 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-06 20:45 [StGIT PATCH 0/5] Proposed patches Catalin Marinas
2008-06-06 20:45 ` Catalin Marinas [this message]
2008-06-07 9:09 ` [StGIT PATCH 1/5] Rename Repository.head to Repository.head_ref Karl Hasselström
2008-06-06 20:45 ` [StGIT PATCH 2/5] Create a git.Branch class as ancestor of stack.Stack Catalin Marinas
2008-06-07 9:16 ` Karl Hasselström
2008-06-06 20:45 ` [StGIT PATCH 3/5] Add stack creation and initialisation support to lib.Stack Catalin Marinas
2008-06-07 9:30 ` Karl Hasselström
2008-06-08 22:03 ` Catalin Marinas
2008-06-06 20:46 ` [StGIT PATCH 4/5] Convert "init" to the new StGIT infrastructure Catalin Marinas
2008-06-07 9:32 ` Karl Hasselström
2008-06-06 20:46 ` [StGIT PATCH 5/5] Add test_patches target to Makefile Catalin Marinas
2008-06-07 9:42 ` Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080606204537.8805.12051.stgit@localhost.localdomain \
--to=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
--cc=kha@treskal.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox