From: Chuck Lever Date: Thu, 6 Oct 2005 12:57:40 +0000 (+0100) Subject: Add support for branch description files X-Git-Tag: v0.14.3~621 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/c1fe1f9953a874eef1f4e975af0430766176e3f2 Add support for branch description files These are single line files that are displayed by "stg branch --list". Signed-off-by: Chuck Lever --- diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index 5ea0ede..56a5fe6 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -73,7 +73,8 @@ def print_branch(branch_name): current = '>' if stack.Series(branch_name).get_protected(): protected = 'p' - print '%s %s%s\t%s' % (current, initialized, protected, branch_name) + print '%s %s%s\t%s\t%s' % (current, initialized, protected, branch_name, \ + stack.Series(branch_name).get_description()) def delete_branch(doomed_name, force = False): if stack.Series(doomed_name).get_protected(): diff --git a/stgit/stack.py b/stgit/stack.py index 554ae8b..33c6d83 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -264,6 +264,7 @@ class Series: self.__applied_file = os.path.join(self.__patch_dir, 'applied') self.__unapplied_file = os.path.join(self.__patch_dir, 'unapplied') self.__current_file = os.path.join(self.__patch_dir, 'current') + self.__descr_file = os.path.join(self.__patch_dir, 'description') def get_branch(self): """Return the branch name for the Series object @@ -327,6 +328,12 @@ class Series: if os.path.isfile(protect_file): os.remove(protect_file) + def get_description(self): + if os.path.isfile(self.__descr_file): + return read_string(self.__descr_file) + else: + return '' + def __patch_is_current(self, patch): return patch.get_name() == read_string(self.__current_file) @@ -379,6 +386,7 @@ class Series: create_empty_file(self.__applied_file) create_empty_file(self.__unapplied_file) + create_empty_file(self.__descr_file) self.__begin_stack_check() def delete(self, force = False): @@ -399,6 +407,8 @@ class Series: os.remove(self.__unapplied_file) if os.path.isfile(self.__current_file): os.remove(self.__current_file) + if os.path.isfile(self.__descr_file): + os.remove(self.__descr_file) if not os.listdir(self.__patch_dir): os.rmdir(self.__patch_dir) else: