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>
Clone a GIT <repository> into the local <dir> and initialise the
patch stack."""
-directory = DirectoryAnywhere()
+directory = DirectoryAnywhere(needs_current_series = False)
options = []
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:
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: