We already had it, but no one was using it
Signed-off-by: Karl Hasselström <kha@treskal.com>
crt = self.get_current()
if not crt:
return None
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
def get_current(self):
"""Return the name of the topmost patch, or None if there is
raise StackException, \
'Cannot delete: the series still contains patches'
for p in patches:
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):
# remove the trash directory if any
if os.path.exists(self.__trash_dir):
if not name:
raise StackException, 'No patches applied'
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):
descr = patch.get_description()
if not (message or descr):
name = self.get_current()
assert(name)
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()
old_bottom = patch.get_old_bottom()
old_top = patch.get_old_top()
if name == None:
name = make_patch_name(descr, self.patch_exists)
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:
patch.create()
if not bottom:
"""Deletes a patch
"""
self.__patch_name_valid(name)
"""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)
if self.__patch_is_current(patch):
self.pop_patch(name)
for name in names:
assert(name in unapplied)
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()
head = top
bottom = patch.get_bottom()
patches detected to have been applied. The state of the tree
is restored to the original one
"""
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 = []
patches.reverse()
merged = []
unapplied = self.get_unapplied()
assert(name in unapplied)
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()
head = git.get_head()
bottom = patch.get_bottom()
name = self.get_current()
assert(name)
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()
old_bottom = patch.get_old_bottom()
old_top = patch.get_old_top()
applied.reverse()
assert(name in applied)
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()):
if git.get_head_file() == self.get_name():
if keep and not git.apply_diff(git.get_head(), patch.get_bottom()):
"""Returns True if the patch is empty
"""
self.__patch_name_valid(name)
"""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()
bottom = patch.get_bottom()
top = patch.get_top()
raise StackException, 'Patch "%s" already exists' % newname
if oldname in unapplied:
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:
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)
applied[applied.index(oldname)] = newname
write_strings(self.__applied_file, applied)