* [StGIT PATCH] Make use of the get_patch() utility function
@ 2007-08-21 20:39 Karl Hasselström
2007-08-21 21:56 ` Karl Hasselström
0 siblings, 1 reply; 3+ messages in thread
From: Karl Hasselström @ 2007-08-21 20:39 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
We already had it, but no one was using it
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
Catalin, would you consider taking this cleanup? It was hidden at the
beginning of my DAG series, so you probably didn't notice it.
stgit/stack.py | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/stgit/stack.py b/stgit/stack.py
index 9c15b3f..c7569b2 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:
@@ -903,7 +903,7 @@ class Series(PatchSet):
"""Deletes a patch
"""
self.__patch_name_valid(name)
- patch = Patch(name, self.__patch_dir, self.__refs_dir)
+ patch = self.get_patch(name)
if self.__patch_is_current(patch):
self.pop_patch(name)
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [StGIT PATCH] Make use of the get_patch() utility function
2007-08-21 20:39 [StGIT PATCH] Make use of the get_patch() utility function Karl Hasselström
@ 2007-08-21 21:56 ` Karl Hasselström
2007-08-22 21:54 ` Catalin Marinas
0 siblings, 1 reply; 3+ messages in thread
From: Karl Hasselström @ 2007-08-21 21:56 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2007-08-21 22:39:11 +0200, Karl Hasselström wrote:
> Catalin, would you consider taking this cleanup? It was hidden at the
> beginning of my DAG series, so you probably didn't notice it.
If you like, you can pull this one, plus a fix from Yann and a fix
from David that you seem to have missed, from the fixes branch at
git://repo.or.cz/stgit/kha.git.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [StGIT PATCH] Make use of the get_patch() utility function
2007-08-21 21:56 ` Karl Hasselström
@ 2007-08-22 21:54 ` Catalin Marinas
0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2007-08-22 21:54 UTC (permalink / raw)
To: Karl Hasselström; +Cc: git
On 21/08/07, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-08-21 22:39:11 +0200, Karl Hasselström wrote:
>
> > Catalin, would you consider taking this cleanup? It was hidden at the
> > beginning of my DAG series, so you probably didn't notice it.
>
> If you like, you can pull this one, plus a fix from Yann and a fix
> from David that you seem to have missed, from the fixes branch at
> git://repo.or.cz/stgit/kha.git.
Much easier :-), thanks.
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-22 21:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21 20:39 [StGIT PATCH] Make use of the get_patch() utility function Karl Hasselström
2007-08-21 21:56 ` Karl Hasselström
2007-08-22 21:54 ` Catalin Marinas
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).