make_option('--update',
help = 'only update the current patch files',
action = 'store_true'),
+ make_option('--index',
+ help = 'use the current contents of the index instead of looking at the working directory',
+ action = 'store_true'),
make_option('--undo',
help = 'revert the commit generated by the last refresh',
action = 'store_true'),
if not patch:
raise CmdException, 'No patches applied'
+ if options.index:
+ if args or options.update:
+ raise CmdException, \
+ 'Only full refresh is available with the --index option'
+ if options.patch:
+ raise CmdException, \
+ '--patch is not compatible with the --index option'
+
if not options.force:
check_head_top_equal(crt_series)
out.done()
return
- files = [path for (stat, path) in git.tree_status(files = args, verbose = True)]
+ if not options.index:
+ files = [path for (stat, path) in git.tree_status(files = args, verbose = True)]
- if files or not crt_series.head_top_equal():
+ if options.index or files or not crt_series.head_top_equal():
if options.patch:
applied = crt_series.get_applied()
between = applied[:applied.index(patch):-1]
if autoresolved == 'yes':
resolved_all()
- crt_series.refresh_patch(files = files,
- backup = True, notes = options.annotate)
+
+ if options.index:
+ crt_series.refresh_patch(cache_update = False,
+ backup = True, notes = options.annotate)
+ else:
+ crt_series.refresh_patch(files = files,
+ backup = True, notes = options.annotate)
if crt_series.empty_patch(patch):
out.done('empty patch')