Raised recently with bug #10276, commands manipulating patches might
fail to run correctly (even losing data) in subdirectories, mainly
because of git-apply (see the bug log for explanation). This patch
forces all the patch-modifying commands to go to the top level
directory before acting.
In addition to the above, ot also fixes the resolved and export
commands.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 files changed:
with the way "assimilate" handles them, you have no reason to avoid
causing them in the first place if that is convenient for you."""
with the way "assimilate" handles them, you have no reason to avoid
causing them in the first place if that is convenient for you."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = []
class Commit(object):
options = []
class Commit(object):
If not given any options, switch to the named branch."""
If not given any options, switch to the named branch."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-c', '--create',
help = 'create a new development branch',
action = 'store_true'),
options = [make_option('-c', '--create',
help = 'create a new development branch',
action = 'store_true'),
unapplied. A patch is considered empty if the two commit objects
representing its boundaries refer to the same tree object."""
unapplied. A patch is considered empty if the two commit objects
representing its boundaries refer to the same tree object."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-a', '--applied',
help = 'delete the empty applied patches',
action = 'store_true'),
options = [make_option('-a', '--applied',
help = 'delete the empty applied patches',
action = 'store_true'),
Use this command only if you want to permanently store the applied
patches and no longer manage them with StGIT."""
Use this command only if you want to permanently store the applied
patches and no longer manage them with StGIT."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
Note that the 'delete' operation is irreversible."""
Note that the 'delete' operation is irreversible."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-b', '--branch',
help = 'use BRANCH instead of the default one')]
options = [make_option('-b', '--branch',
help = 'use BRANCH instead of the default one')]
these files using the '--file' and '--diff' options.
"""
these files using the '--file' and '--diff' options.
"""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-d', '--diff',
help = 'edit the patch diff',
action = 'store_true'),
options = [make_option('-d', '--diff',
help = 'edit the patch diff',
action = 'store_true'),
dirname = options.dir
else:
dirname = 'patches-%s' % crt_series.get_name()
dirname = options.dir
else:
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;'
this. The '--series' option can be used to rearrange the (top) patches
as specified by the given series file (or the standard input)."""
this. The '--series' option can be used to rearrange the (top) patches
as specified by the given series file (or the standard input)."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-s', '--series',
help = 'rearrange according to a series file',
action = 'store_true')]
options = [make_option('-s', '--series',
help = 'rearrange according to a series file',
action = 'store_true')]
--to' commands. There is no '--undo' option for 'goto'. Use the 'push'
command for this."""
--to' commands. There is no '--undo' option for 'goto'. Use the 'push'
command for this."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-k', '--keep',
help = 'keep the local changes when popping patches',
action = 'store_true')]
options = [make_option('-k', '--keep',
help = 'keep the local changes when popping patches',
action = 'store_true')]
If no name is given for the new patch, one is generated from the first
line of the commit message."""
If no name is given for the new patch, one is generated from the first
line of the commit message."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-m', '--message',
help = 'use MESSAGE as the patch description'),
make_option('-s', '--showpatch',
options = [make_option('-m', '--message',
help = 'use MESSAGE as the patch description'),
make_option('-s', '--showpatch',
option. A commit object can be reverted with the '--reverse'
option. The log and author information are those of the commit object."""
option. A commit object can be reverted with the '--reverse'
option. The log and author information are those of the commit object."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-n', '--name',
help = 'use NAME as the patch name'),
make_option('-r', '--reverse',
options = [make_option('-n', '--name',
help = 'use NAME as the patch name'),
make_option('-r', '--reverse',
the push operations may fail because of conflicts (push --undo would
revert the last push operation)."""
the push operations may fail because of conflicts (push --undo would
revert the last push operation)."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-a', '--all',
help = 'pop all the applied patches',
action = 'store_true'),
options = [make_option('-a', '--all',
help = 'pop all the applied patches',
action = 'store_true'),
Check the 'git fetch' documentation for the <repository> format."""
Check the 'git fetch' documentation for the <repository> format."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after pulling',
action = 'store_true'),
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after pulling',
action = 'store_true'),
Pop all patches from current stack, move the stack base to the given
<new-base-id> and push the patches back."""
Pop all patches from current stack, move the stack base to the given
<new-base-id> and push the patches back."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after rebasing',
action = 'store_true'),
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after rebasing',
action = 'store_true'),
def func(parser, options, args):
"""Mark the conflict as resolved
"""
def func(parser, options, args):
"""Mark the conflict as resolved
"""
+ args = git.ls_files(args)
+ directory.cd_to_topdir()
+
if options.reset \
and options.reset not in file_extensions():
raise CmdException, 'Unknown reset state: %s' % options.reset
if options.reset \
and options.reset not in file_extensions():
raise CmdException, 'Unknown reset state: %s' % options.reset
then push back into place the formerly-applied patches (unless -n
is also given)."""
then push back into place the formerly-applied patches (unless -n
is also given)."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after sinking',
action = 'store_true'),
options = [make_option('-n', '--nopush',
help = 'do not push the patches back after sinking',
action = 'store_true'),
The sync operation can be reverted for individual patches with --undo."""
The sync operation can be reverted for individual patches with --undo."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-a', '--all',
help = 'synchronise all the patches',
action = 'store_true'),
options = [make_option('-a', '--all',
help = 'synchronise all the patches',
action = 'store_true'),
Only commits with exactly one parent can be uncommitted; in other
words, you can't uncommit a merge."""
Only commits with exactly one parent can be uncommitted; in other
words, you can't uncommit a merge."""
-directory = DirectoryHasRepository()
+directory = DirectoryGotoToplevel()
options = [make_option('-n', '--number', type = 'int',
help = 'uncommit the specified number of commits'),
make_option('-t', '--to',
options = [make_option('-n', '--number', type = 'int',
help = 'uncommit the specified number of commits'),
make_option('-t', '--to',