chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a --parent flag to "stgit pick".
[stgit]
/
stgit
/
stack.py
diff --git
a/stgit/stack.py
b/stgit/stack.py
index f83161bd28cb2e9b49d13df8d9a7ddad54b9e376..618182c6a5106e44b0a6e8cef4b2580446635b5c 100644
(file)
--- a/
stgit/stack.py
+++ b/
stgit/stack.py
@@
-21,7
+21,7
@@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys, os
from stgit.utils import *
import sys, os
from stgit.utils import *
-from stgit import git, basedir
+from stgit import git, basedir
, templates
from stgit.config import config
from stgit.config import config
@@
-65,14
+65,14
@@
def __clean_comments(f):
f.writelines(lines)
def edit_file(series, line, comment, show_patch = True):
f.writelines(lines)
def edit_file(series, line, comment, show_patch = True):
- fname = '.stgit
.msg
'
- tmpl =
os.path.join(basedir.get(),
'patchdescr.tmpl')
+ fname = '.stgit
msg.txt
'
+ tmpl =
templates.get_template(
'patchdescr.tmpl')
f = file(fname, 'w+')
if line:
print >> f, line
f = file(fname, 'w+')
if line:
print >> f, line
- elif
os.path.isfile(tmpl)
:
- print >> f,
file(tmpl).read().rstrip()
+ elif
tmpl
:
+ print >> f,
tmpl,
else:
print >> f
print >> f, __comment_prefix, comment
else:
print >> f
print >> f, __comment_prefix, comment
@@
-443,8
+443,7
@@
class Series:
os.makedirs(self.__patch_dir)
os.makedirs(self.__patch_dir)
- if not os.path.isdir(bases_dir):
- os.makedirs(bases_dir)
+ create_dirs(bases_dir)
create_empty_file(self.__applied_file)
create_empty_file(self.__unapplied_file)
create_empty_file(self.__applied_file)
create_empty_file(self.__unapplied_file)
@@
-502,11
+501,14
@@
class Series:
git.rename_branch(self.__name, to_name)
if os.path.isdir(self.__series_dir):
git.rename_branch(self.__name, to_name)
if os.path.isdir(self.__series_dir):
- os.rename(self.__series_dir, to_stack.__series_dir)
+ rename(os.path.join(self.__base_dir, 'patches'),
+ self.__name, to_stack.__name)
if os.path.exists(self.__base_file):
if os.path.exists(self.__base_file):
- os.rename(self.__base_file, to_stack.__base_file)
+ rename(os.path.join(self.__base_dir, 'refs', 'bases'),
+ self.__name, to_stack.__name)
if os.path.exists(self.__refs_dir):
if os.path.exists(self.__refs_dir):
- os.rename(self.__refs_dir, to_stack.__refs_dir)
+ rename(os.path.join(self.__base_dir, 'refs', 'patches'),
+ self.__name, to_stack.__name)
self.__init__(to_name)
self.__init__(to_name)
@@
-560,16
+562,19
@@
class Series:
else:
print 'Patch directory %s is not empty.' % self.__name
if not os.listdir(self.__series_dir):
else:
print 'Patch directory %s is not empty.' % self.__name
if not os.listdir(self.__series_dir):
- os.rmdir(self.__series_dir)
+ remove_dirs(os.path.join(self.__base_dir, 'patches'),
+ self.__name)
else:
print 'Series directory %s is not empty.' % self.__name
if not os.listdir(self.__refs_dir):
else:
print 'Series directory %s is not empty.' % self.__name
if not os.listdir(self.__refs_dir):
- os.rmdir(self.__refs_dir)
+ remove_dirs(os.path.join(self.__base_dir, 'refs', 'patches'),
+ self.__name)
else:
print 'Refs directory %s is not empty.' % self.__refs_dir
if os.path.exists(self.__base_file):
else:
print 'Refs directory %s is not empty.' % self.__refs_dir
if os.path.exists(self.__base_file):
- os.remove(self.__base_file)
+ remove_file_and_dirs(
+ os.path.join(self.__base_dir, 'refs', 'bases'), self.__name)
def refresh_patch(self, files = None, message = None, edit = False,
show_patch = False,
def refresh_patch(self, files = None, message = None, edit = False,
show_patch = False,
@@
-707,6
+712,8
@@
class Series:
append_string(self.__applied_file, patch.get_name())
self.__set_current(name)
append_string(self.__applied_file, patch.get_name())
self.__set_current(name)
+ self.refresh_patch(cache_update = False)
+
def delete_patch(self, name):
"""Deletes a patch
"""
def delete_patch(self, name):
"""Deletes a patch
"""