~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use git-rev-parse to find the local GIT repository
[stgit]
/
stgit
/
commands
/
export.py
diff --git
a/stgit/commands/export.py
b/stgit/commands/export.py
index
ebcc77a
..
b33c9ea
100644
(file)
--- a/
stgit/commands/export.py
+++ b/
stgit/commands/export.py
@@
-56,18
+56,20
@@
options = [make_option('-n', '--numbered',
help = 'Use FILE as a template'),
make_option('-r', '--range',
metavar = '[PATCH1][:[PATCH2]]',
help = 'Use FILE as a template'),
make_option('-r', '--range',
metavar = '[PATCH1][:[PATCH2]]',
- help = 'export patches between PATCH1 and PATCH2')]
+ help = 'export patches between PATCH1 and PATCH2'),
+ make_option('-b', '--branch',
+ help = 'use BRANCH instead of the default one')]
def func(parser, options, args):
if len(args) == 0:
def func(parser, options, args):
if len(args) == 0:
- dirname = 'patches
'
+ dirname = 'patches
-%s' % crt_series.get_branch()
elif len(args) == 1:
dirname = args[0]
else:
parser.error('incorrect number of arguments')
elif len(args) == 1:
dirname = args[0]
else:
parser.error('incorrect number of arguments')
- if git.local_changes():
+ if
not options.branch and
git.local_changes():
print 'Warning: local changes in the tree. ' \
'You might want to commit them first'
print 'Warning: local changes in the tree. ' \
'You might want to commit them first'
@@
-76,6
+78,7
@@
def func(parser, options, args):
series = file(os.path.join(dirname, 'series'), 'w+')
applied = crt_series.get_applied()
series = file(os.path.join(dirname, 'series'), 'w+')
applied = crt_series.get_applied()
+ unapplied = crt_series.get_unapplied()
if options.range:
boundaries = options.range.split(':')
if options.range:
boundaries = options.range.split(':')
@@
-97,11
+100,18
@@
def func(parser, options, args):
if start in applied:
start_idx = applied.index(start)
else:
if start in applied:
start_idx = applied.index(start)
else:
- raise CmdException, 'Patch "%s" not applied' % start
+ if start in unapplied:
+ raise CmdException, 'Patch "%s" not applied' % start
+ else:
+ raise CmdException, 'Patch "%s" does not exist' % start
+
if stop in applied:
stop_idx = applied.index(stop) + 1
else:
if stop in applied:
stop_idx = applied.index(stop) + 1
else:
- raise CmdException, 'Patch "%s" not applied' % stop
+ if stop in unapplied:
+ raise CmdException, 'Patch "%s" not applied' % stop
+ else:
+ raise CmdException, 'Patch "%s" does not exist' % stop
if start_idx >= stop_idx:
raise CmdException, 'Incorrect patch range order'
if start_idx >= stop_idx:
raise CmdException, 'Incorrect patch range order'
@@
-122,7
+132,7
@@
def func(parser, options, args):
else:
patch_tmpl_list = []
else:
patch_tmpl_list = []
- patch_tmpl_list += [os.path.join(git.
base_dir
, 'patchexport.tmpl'),
+ patch_tmpl_list += [os.path.join(git.
get_base_dir()
, 'patchexport.tmpl'),
os.path.join(sys.prefix,
'share/stgit/templates/patchexport.tmpl')]
tmpl = ''
os.path.join(sys.prefix,
'share/stgit/templates/patchexport.tmpl')]
tmpl = ''
@@
-145,8
+155,8
@@
def func(parser, options, args):
patch = crt_series.get_patch(p)
tmpl_dict = {'description': patch.get_description().rstrip(),
patch = crt_series.get_patch(p)
tmpl_dict = {'description': patch.get_description().rstrip(),
- 'diffstat': git.diffstat(rev1 =
git_id('%s/bottom' % p
),
- rev2 =
git_id('%s/top' % p
)),
+ 'diffstat': git.diffstat(rev1 =
patch.get_bottom(
),
+ rev2 =
patch.get_top(
)),
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate(),
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate(),
@@
-168,8
+178,8
@@
def func(parser, options, args):
f.write(descr)
# write the diff
f.write(descr)
# write the diff
- git.diff(rev1 =
git_id('%s/bottom' % p
),
- rev2 =
git_id('%s/top' % p
),
+ git.diff(rev1 =
patch.get_bottom(
),
+ rev2 =
patch.get_top(
),
out_fd = f)
f.close()
patch_no += 1
out_fd = f)
f.close()
patch_no += 1