chiark / gitweb /
Add support for branch description files
authorChuck Lever <cel@netapp.com>
Thu, 6 Oct 2005 12:57:40 +0000 (13:57 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 6 Oct 2005 12:57:40 +0000 (13:57 +0100)
These are single line files that are displayed by "stg branch --list".

Signed-off-by: Chuck Lever <cel@netapp.com>
stgit/commands/branch.py
stgit/stack.py

index 5ea0ede65556d147d250402d42935c9e354e2e2f..56a5fe608634d8af075658f4ffebabbc2698dbaf 100644 (file)
@@ -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():
index 554ae8bd64fef072bd5e3211882829285571b8bc..33c6d83d52f511e3fdbfecd7e81507ef21643b8e 100644 (file)
@@ -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: