chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'stable'
[stgit]
/
stgit
/
commands
/
export.py
diff --git
a/stgit/commands/export.py
b/stgit/commands/export.py
index d6b36a959b09c87c7db3db763347b450d2d3d44e..6ebfd2aecf910d0d151d0fdff13f23df2ba0a2df 100644
(file)
--- a/
stgit/commands/export.py
+++ b/
stgit/commands/export.py
@@
-23,6
+23,7
@@
from optparse import OptionParser, make_option
from stgit.commands.common import *
from stgit.utils import *
from stgit.commands.common import *
from stgit.utils import *
+from stgit.out import *
from stgit import stack, git, templates
from stgit import stack, git, templates
@@
-48,6
+49,7
@@
file:
%(commemail)s - committer's e-mail
"""
%(commemail)s - committer's e-mail
"""
+directory = DirectoryHasRepository()
options = [make_option('-d', '--dir',
help = 'export patches to DIR instead of the default'),
make_option('-p', '--patch',
options = [make_option('-d', '--dir',
help = 'export patches to DIR instead of the default'),
make_option('-p', '--patch',
@@
-62,12
+64,10
@@
options = [make_option('-d', '--dir',
help = 'Use FILE as a template'),
make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
help = 'Use FILE as a template'),
make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
- make_option('--binary',
- help = 'output a diff even for binary files',
- action = 'store_true'),
make_option('-s', '--stdout',
help = 'dump the patches to the standard output',
make_option('-s', '--stdout',
help = 'dump the patches to the standard output',
- action = 'store_true')]
+ action = 'store_true')
+ ] + make_diff_opts_option()
def func(parser, options, args):
def func(parser, options, args):
@@
-76,7
+76,8
@@
def func(parser, options, args):
if options.dir:
dirname = options.dir
else:
if options.dir:
dirname = options.dir
else:
- dirname = 'patches-%s' % crt_series.get_branch()
+ dirname = 'patches-%s' % crt_series.get_name()
+ directory.cd_to_topdir()
if not options.branch and git.local_changes():
out.warn('Local changes in the tree;'
if not options.branch and git.local_changes():
out.warn('Local changes in the tree;'
@@
-87,14
+88,10
@@
def func(parser, options, args):
os.makedirs(dirname)
series = file(os.path.join(dirname, 'series'), 'w+')
os.makedirs(dirname)
series = file(os.path.join(dirname, 'series'), 'w+')
- if options.binary:
- diff_flags = [ '--binary' ]
- else:
- diff_flags = []
-
applied = crt_series.get_applied()
applied = crt_series.get_applied()
+ unapplied = crt_series.get_unapplied()
if len(args) != 0:
if len(args) != 0:
- patches = parse_patches(args, applied)
+ patches = parse_patches(args, applied
+ unapplied, len(applied)
)
else:
patches = applied
else:
patches = applied
@@
-142,11
+139,13
@@
def func(parser, options, args):
long_descr = reduce(lambda x, y: x + '\n' + y,
descr_lines[1:], '').strip()
long_descr = reduce(lambda x, y: x + '\n' + y,
descr_lines[1:], '').strip()
+ diff = git.diff(rev1 = patch.get_bottom(),
+ rev2 = patch.get_top(),
+ diff_flags = options.diff_flags)
tmpl_dict = {'description': patch.get_description().rstrip(),
'shortdescr': short_descr,
'longdescr': long_descr,
tmpl_dict = {'description': patch.get_description().rstrip(),
'shortdescr': short_descr,
'longdescr': long_descr,
- 'diffstat': git.diffstat(rev1 = patch.get_bottom(),
- rev2 = patch.get_top()),
+ 'diffstat': git.diffstat(diff),
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate(),
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate(),
@@
-175,13
+174,8
@@
def func(parser, options, args):
print patch.get_name()
print '-'*79
print patch.get_name()
print '-'*79
- # write description
f.write(descr)
f.write(descr)
- # write the diff
- git.diff(rev1 = patch.get_bottom(),
- rev2 = patch.get_top(),
- out_fd = f,
- diff_flags = diff_flags )
+ f.write(diff)
if not options.stdout:
f.close()
patch_no += 1
if not options.stdout:
f.close()
patch_no += 1