From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH 1/5] Make use of the get_patch() utility function
Date: Tue, 07 Aug 2007 04:47:44 +0200 [thread overview]
Message-ID: <20070807024744.11373.31514.stgit@yoghurt> (raw)
In-Reply-To: <20070807024508.11373.62875.stgit@yoghurt>
We already had it, but no one was using it
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/stack.py | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py
index dbd7ea4..6f87f28 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -466,7 +466,7 @@ class Series(PatchSet):
crt = self.get_current()
if not crt:
return None
- return Patch(crt, self.__patch_dir, self.__refs_dir)
+ return self.get_patch(crt)
def get_current(self):
"""Return the name of the topmost patch, or None if there is
@@ -684,7 +684,7 @@ class Series(PatchSet):
raise StackException, \
'Cannot delete: the series still contains patches'
for p in patches:
- Patch(p, self.__patch_dir, self.__refs_dir).delete()
+ self.get_patch(p).delete()
# remove the trash directory if any
if os.path.exists(self.__trash_dir):
@@ -741,7 +741,7 @@ class Series(PatchSet):
if not name:
raise StackException, 'No patches applied'
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
descr = patch.get_description()
if not (message or descr):
@@ -807,7 +807,7 @@ class Series(PatchSet):
name = self.get_current()
assert(name)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
old_bottom = patch.get_old_bottom()
old_top = patch.get_old_top()
@@ -848,7 +848,7 @@ class Series(PatchSet):
if name == None:
name = make_patch_name(descr, self.patch_exists)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
patch.create()
if not bottom:
@@ -936,7 +936,7 @@ class Series(PatchSet):
for name in names:
assert(name in unapplied)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
head = top
bottom = patch.get_bottom()
@@ -1002,8 +1002,7 @@ class Series(PatchSet):
patches detected to have been applied. The state of the tree
is restored to the original one
"""
- patches = [Patch(name, self.__patch_dir, self.__refs_dir)
- for name in names]
+ patches = [self.get_patch(name) for name in names]
patches.reverse()
merged = []
@@ -1022,7 +1021,7 @@ class Series(PatchSet):
unapplied = self.get_unapplied()
assert(name in unapplied)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
head = git.get_head()
bottom = patch.get_bottom()
@@ -1096,7 +1095,7 @@ class Series(PatchSet):
name = self.get_current()
assert(name)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
old_bottom = patch.get_old_bottom()
old_top = patch.get_old_top()
@@ -1122,7 +1121,7 @@ class Series(PatchSet):
applied.reverse()
assert(name in applied)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
if git.get_head_file() == self.get_name():
if keep and not git.apply_diff(git.get_head(), patch.get_bottom()):
@@ -1148,7 +1147,7 @@ class Series(PatchSet):
"""Returns True if the patch is empty
"""
self.__patch_name_valid(name)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
bottom = patch.get_bottom()
top = patch.get_top()
@@ -1173,11 +1172,11 @@ class Series(PatchSet):
raise StackException, 'Patch "%s" already exists' % newname
if oldname in unapplied:
- Patch(oldname, self.__patch_dir, self.__refs_dir).rename(newname)
+ self.get_patch(oldname).rename(newname)
unapplied[unapplied.index(oldname)] = newname
write_strings(self.__unapplied_file, unapplied)
elif oldname in applied:
- Patch(oldname, self.__patch_dir, self.__refs_dir).rename(newname)
+ self.get_patch(oldname).rename(newname)
applied[applied.index(oldname)] = newname
write_strings(self.__applied_file, applied)
next prev parent reply other threads:[~2007-08-07 2:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 2:47 [StGIT PATCH 0/5] Compute patch appliedness using the commit DAG Karl Hasselström
2007-08-07 2:47 ` Karl Hasselström [this message]
2007-08-07 2:47 ` [StGIT PATCH 2/5] Compute patch appliedness from " Karl Hasselström
2007-08-07 2:47 ` [StGIT PATCH 3/5] Test the new DAG appliedness machinery Karl Hasselström
2007-08-07 2:48 ` [StGIT PATCH 4/5] Fix bash completion after the DAG appliedness patch Karl Hasselström
2007-08-07 2:48 ` [StGIT PATCH 5/5] Speed up the appliedness test 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=20070807024744.11373.31514.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 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).