From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 4/6] Refactor crt_series creation
Date: Mon, 08 Oct 2007 10:55:29 +0200 [thread overview]
Message-ID: <20071008085529.9734.42383.stgit@yoghurt> (raw)
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
Instead of hard-coding in main.py which commands do and don't need a
current series, let them speak for themselves.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/clone.py | 2 +-
stgit/commands/common.py | 2 ++
stgit/main.py | 5 ++---
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/stgit/commands/clone.py b/stgit/commands/clone.py
index a150010..c3b0bbe 100644
--- a/stgit/commands/clone.py
+++ b/stgit/commands/clone.py
@@ -29,7 +29,7 @@ usage = """%prog [options] <repository> <dir>
Clone a GIT <repository> into the local <dir> and initialise the
patch stack."""
-directory = DirectoryAnywhere()
+directory = DirectoryAnywhere(needs_current_series = False)
options = []
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 27ef465..652039f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -497,6 +497,8 @@ class DirectoryException(StgException):
pass
class _Directory(object):
+ def __init__(self, needs_current_series = True):
+ self.needs_current_series = needs_current_series
@readonly_constant_property
def git_dir(self):
try:
diff --git a/stgit/main.py b/stgit/main.py
index 8e00217..db327f1 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -271,9 +271,8 @@ def main():
directory.setup()
config_setup()
- # 'clone' doesn't expect an already initialised GIT tree. A Series
- # object will be created after the GIT tree is cloned
- if cmd != 'clone':
+ # Some commands don't (always) need an initialized series.
+ if directory.needs_current_series:
if hasattr(options, 'branch') and options.branch:
command.crt_series = Series(options.branch)
else:
next prev parent reply other threads:[~2007-10-08 8:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-08 8:55 [StGit PATCH 0/6] Survive capital punishment Karl Hasselström
2007-10-08 8:55 ` [StGit PATCH 1/6] Allow caller to customize title of error/warning message Karl Hasselström
2007-10-08 8:55 ` [StGit PATCH 2/6] Use our nice message printout wrapping system Karl Hasselström
2007-10-08 8:55 ` [StGit PATCH 3/6] Properly detect that HEAD is detached Karl Hasselström
2007-10-08 8:55 ` Karl Hasselström [this message]
2007-10-08 8:55 ` [StGit PATCH 5/6] Don't have a global crt_series in stgit.commans.common Karl Hasselström
2007-10-08 8:55 ` [StGit PATCH 6/6] Let some commands work with detached HEAD Karl Hasselström
2007-10-08 15:34 ` Karl Hasselström
2007-10-09 4:42 ` [StGit PATCH] New test: "stg diff" Karl Hasselström
2007-10-09 5:12 ` [StGit PATCH 6/6] Let some commands work with detached HEAD Karl Hasselström
2007-10-08 8:58 ` [StGit PATCH 0/6] Survive capital punishment Karl Hasselström
2007-10-08 9:27 ` 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=20071008085529.9734.42383.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.