"""
import sys, os, re
+from email.Utils import formatdate
from stgit.utils import *
from stgit.out import *
f.seek(0); f.truncate()
f.writelines(lines)
+# TODO: move this out of the stgit.stack module, it is really for
+# higher level commands to handle the user interaction
def edit_file(series, line, comment, show_patch = True):
fname = '.stgitmsg.txt'
tmpl = templates.get_template('patchdescr.tmpl')
self._set_field('authemail', email or git.author().email)
def get_authdate(self):
- return self._get_field('authdate')
+ date = self._get_field('authdate')
+ if not date:
+ return date
+
+ if re.match('[0-9]+\s+[+-][0-9]+', date):
+ # Unix time (seconds) + time zone
+ secs_tz = date.split()
+ date = formatdate(int(secs_tz[0]))[:-5] + secs_tz[1]
+
+ return date
def set_authdate(self, date):
self._set_field('authdate', date or git.author().date)
return bool(config.get(self.format_version_key()))
+def shortlog(patches):
+ log = ''.join(Run('git-log', '--pretty=short',
+ p.get_top(), '^%s' % p.get_bottom()).raw_output()
+ for p in patches)
+ return Run('git-shortlog').raw_input(log).raw_output()
+
class Series(PatchSet):
"""Class including the operations on series
"""
elif message:
descr = message
+ # TODO: move this out of the stgit.stack module, it is really
+ # for higher level commands to handle the user interaction
if not message and edit:
descr = edit_file(self, descr.rstrip(), \
'Please edit the description for patch "%s" ' \
if self.patch_exists(name):
raise StackException, 'Patch "%s" already exists' % name
+ # TODO: move this out of the stgit.stack module, it is really
+ # for higher level commands to handle the user interaction
if not message and can_edit:
descr = edit_file(
self, None,