git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>,
	Yann Dirson <ydirson@altern.org>, Carl Worth <cworth@cworth.org>,
	Petr Baudis <pasky@suse.cz>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Johannes Sixt <J.Sixt@eudaptics.com>
Subject: [StGIT PATCH] Store branch description in the config file
Date: Mon, 14 May 2007 21:28:10 +0200	[thread overview]
Message-ID: <20070514192528.26543.75736.stgit@yoghurt> (raw)
In-Reply-To: <7vy7jtyh8q.fsf@assigned-by-dhcp.cox.net>

Instead of storing the branch description in an StGIT-specific file,
store it in the git config file, where tools other than StGIT can read
and write it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---

On 2007-05-12 12:27:49 -0700, Junio C Hamano wrote:

> Will it be something like
>
>       [branch "master"]
>               description = "My primary development line"

This was easier to do than I'd thought. I don't get quotes around the
description, though; do I have to insert them manually? And what
purpose do they serve?

 stgit/stack.py |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
index c105b21..7048af7 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -451,7 +451,6 @@ class Series(StgitObject):
                                        self.__name)
 
         self.__hidden_file = os.path.join(self._dir(), 'hidden')
-        self.__descr_file = os.path.join(self._dir(), 'description')
 
         # where this series keeps its patches
         self.__patch_dir = os.path.join(self._dir(), 'patches')
@@ -550,11 +549,23 @@ class Series(StgitObject):
         if os.path.isfile(protect_file):
             os.remove(protect_file)
 
+    def __branch_descr(self):
+        return 'branch.%s.description' % self.get_branch()
+
     def get_description(self):
-        return self._get_field('description') or ''
+        # Fall back to the .git/patches/<branch>/description file if
+        # the config variable is unset.
+        return (config.get(self.__branch_descr())
+                or self._get_field('description') or '')
 
     def set_description(self, line):
-        self._set_field('description', line)
+        if line:
+            config.set(self.__branch_descr(), line)
+        else:
+            config.unset(self.__branch_descr())
+        # Delete the old .git/patches/<branch>/description file if it
+        # exists.
+        self._set_field('description', None)
 
     def get_parent_remote(self):
         value = config.get('branch.%s.remote' % self.__name)
@@ -787,8 +798,6 @@ class Series(StgitObject):
             # (move functionality to StgitObject ?)
             if os.path.exists(self.__hidden_file):
                 os.remove(self.__hidden_file)
-            if os.path.exists(self.__descr_file):
-                os.remove(self.__descr_file)
             if os.path.exists(self._dir()+'/orig-base'):
                 os.remove(self._dir()+'/orig-base')
 

  parent reply	other threads:[~2007-05-14 19:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10 10:51 Merging commits together into a super-commit Alex Bennee
2007-05-10 11:19 ` Raimund Bauer
2007-05-10 11:32   ` Alex Bennee
2007-05-10 11:43     ` Johannes Schindelin
2007-05-10 11:40 ` Johannes Sixt
2007-05-10 16:01   ` Linus Torvalds
2007-05-10 16:57     ` Carl Worth
2007-05-10 17:14       ` J. Bruce Fields
2007-05-10 18:30         ` Carl Worth
2007-05-10 19:21           ` Petr Baudis
2007-05-10 19:48             ` Carl Worth
2007-05-10 20:02               ` Using StGIT for tweaking already-committed stuff Petr Baudis
2007-05-10 21:16                 ` Carl Worth
2007-05-11  5:48                   ` Integrate StGIT into Git? (Was: Re: Using StGIT for tweaking already-committed stuff) Jan Hudec
2007-05-10 22:23                 ` Using StGIT for tweaking already-committed stuff Karl Hasselström
2007-05-11 20:40                   ` Yann Dirson
2007-05-11 22:43                     ` Karl Hasselström
2007-05-12  7:10                       ` Yann Dirson
2007-05-12 11:09                         ` Karl Hasselström
2007-05-10 20:29               ` Merging commits together into a super-commit Robin Rosenberg
2007-05-12 11:34               ` Yann Dirson
2007-05-12 13:59                 ` Jakub Narebski
2007-05-12 14:02                 ` Karl Hasselström
2007-05-12 14:41                   ` Yann Dirson
2007-05-12 17:03                     ` Karl Hasselström
2007-05-12 19:27                     ` Junio C Hamano
2007-05-13 18:43                       ` Karl Hasselström
2007-05-13 19:35                       ` Yann Dirson
2007-05-14 19:28                       ` Karl Hasselström [this message]
2007-05-10 19:22           ` J. Bruce Fields
2007-05-10 19:47             ` Petr Baudis
2007-05-10 19:51               ` J. Bruce Fields
2007-05-12  9:53       ` Transactions for git (and stgit) ? Yann Dirson
2007-05-12 10:49         ` Karl Hasselström
2007-05-12 18:34           ` Yann Dirson

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=20070514192528.26543.75736.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=J.Sixt@eudaptics.com \
    --cc=bfields@fieldses.org \
    --cc=catalin.marinas@gmail.com \
    --cc=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=pasky@suse.cz \
    --cc=torvalds@linux-foundation.org \
    --cc=ydirson@altern.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).