We already had it, but no one was using it Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx> --- stgit/stack.py | 27 +++++++++++++-------------- 1 files changed, 13 insertions(+), 14 deletions(-) diff --git a/stgit/stack.py b/stgit/stack.py index 7a06458..0a486bd 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -404,7 +404,7 @@ class Series(StgitObject): 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 @@ -678,7 +678,7 @@ class Series(StgitObject): 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 for fname in os.listdir(self.__trash_dir): @@ -732,7 +732,7 @@ class Series(StgitObject): 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): @@ -798,7 +798,7 @@ class Series(StgitObject): 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() @@ -839,7 +839,7 @@ class Series(StgitObject): 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 bottom: @@ -919,7 +919,7 @@ class Series(StgitObject): 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() @@ -988,8 +988,7 @@ class Series(StgitObject): 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 = [] @@ -1008,7 +1007,7 @@ class Series(StgitObject): 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() @@ -1084,7 +1083,7 @@ class Series(StgitObject): 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() @@ -1110,7 +1109,7 @@ class Series(StgitObject): 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_branch(): if keep and not git.apply_diff(git.get_head(), patch.get_bottom()): @@ -1142,7 +1141,7 @@ class Series(StgitObject): """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() @@ -1171,14 +1170,14 @@ class Series(StgitObject): self.hide_patch(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 f = file(self.__unapplied_file, 'w+') f.writelines([line + '\n' for line in unapplied]) f.close() 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html