* [StGit PATCH 0/5] More UI clean-up
@ 2009-09-16 21:40 Catalin Marinas
2009-09-16 21:40 ` [StGit PATCH 1/5] Remove the 'fail_dump' argument to git.apply_patch() Catalin Marinas
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:40 UTC (permalink / raw)
To: Karl Hasselström, git
The series adds makes the fold and import options consistent regarding
the -p and --reject options. The autosigning of new patches was extended
to the import command as well.
---
Catalin Marinas (5):
Remove the 'fail_dump' argument to git.apply_patch()
Add the --reject option to fold
Do not create an empty patch if import failed without --reject
Add the -p option to fold
Autosign imported patches
stgit/commands/fold.py | 15 +++++++++++----
stgit/commands/imprt.py | 18 +++++++++++++-----
stgit/git.py | 11 ++---------
3 files changed, 26 insertions(+), 18 deletions(-)
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* [StGit PATCH 1/5] Remove the 'fail_dump' argument to git.apply_patch()
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
@ 2009-09-16 21:40 ` Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 2/5] Add the --reject option to fold Catalin Marinas
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:40 UTC (permalink / raw)
To: Karl Hasselström, git
Since we have a 'reject' argument, there is no need for the failed diff
to be dumped.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/git.py | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/stgit/git.py b/stgit/git.py
index 012e282..97b1e96 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -818,7 +818,7 @@ def repack():
GRun('repack', '-a', '-d', '-f').run()
def apply_patch(filename = None, diff = None, base = None,
- fail_dump = True, reject = False, strip = None):
+ reject = False, strip = None):
"""Apply a patch onto the current or given index. There must not
be any local changes in the tree, otherwise the command fails
"""
@@ -847,14 +847,7 @@ def apply_patch(filename = None, diff = None, base = None,
except GitRunException:
if base:
switch(orig_head)
- if fail_dump:
- # write the failed diff to a file
- f = file('.stgit-failed.patch', 'w+')
- f.write(diff)
- f.close()
- out.warn('Diff written to the .stgit-failed.patch file')
-
- raise
+ raise GitException('Diff does not apply cleanly')
if base:
top = commit(message = 'temporary commit used for applying a patch',
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [StGit PATCH 2/5] Add the --reject option to fold
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
2009-09-16 21:40 ` [StGit PATCH 1/5] Remove the 'fail_dump' argument to git.apply_patch() Catalin Marinas
@ 2009-09-16 21:41 ` Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 3/5] Do not create an empty patch if import failed without --reject Catalin Marinas
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:41 UTC (permalink / raw)
To: Karl Hasselström, git
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/fold.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/stgit/commands/fold.py b/stgit/commands/fold.py
index 66a2dd9..28e824c 100644
--- a/stgit/commands/fold.py
+++ b/stgit/commands/fold.py
@@ -38,7 +38,9 @@ options = [
opt('-t', '--threeway', action = 'store_true',
short = 'Perform a three-way merge with the current patch'),
opt('-b', '--base', args = [argparse.commit],
- short = 'Use BASE instead of HEAD applying the patch')]
+ short = 'Use BASE instead of HEAD when applying the patch'),
+ opt('--reject', action = 'store_true',
+ short = 'Leave the rejected hunks in corresponding *.rej files')]
directory = DirectoryHasRepository(log = True)
@@ -72,11 +74,12 @@ def func(parser, options, args):
if options.threeway:
crt_patch = crt_series.get_patch(current)
bottom = crt_patch.get_bottom()
- git.apply_patch(filename = filename, base = bottom)
+ git.apply_patch(filename = filename, base = bottom,
+ reject = options.reject)
elif options.base:
- git.apply_patch(filename = filename,
+ git.apply_patch(filename = filename, reject = options.reject,
base = git_id(crt_series, options.base))
else:
- git.apply_patch(filename = filename)
+ git.apply_patch(filename = filename, reject = options.reject)
out.done()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [StGit PATCH 3/5] Do not create an empty patch if import failed without --reject
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
2009-09-16 21:40 ` [StGit PATCH 1/5] Remove the 'fail_dump' argument to git.apply_patch() Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 2/5] Add the --reject option to fold Catalin Marinas
@ 2009-09-16 21:41 ` Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 4/5] Add the -p option to fold Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 5/5] Autosign imported patches Catalin Marinas
4 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:41 UTC (permalink / raw)
To: Karl Hasselström, git
If the import failed, do not leave an empty patch on the stack. If this
is required, the --reject option should be passed. The patch also fixes
a lowercase typo in the --reject option description.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/imprt.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index aa75065..de77635 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -68,7 +68,7 @@ options = [
opt('-b', '--base', args = [argparse.commit],
short = 'Use BASE instead of HEAD for file importing'),
opt('--reject', action = 'store_true',
- short = 'leave the rejected hunks in corresponding *.rej files'),
+ short = 'Leave the rejected hunks in corresponding *.rej files'),
opt('-e', '--edit', action = 'store_true',
short = 'Invoke an editor for the patch description'),
opt('-d', '--showdiff', action = 'store_true',
@@ -154,8 +154,13 @@ def __create_patch(filename, message, author_name, author_email,
base = git_id(crt_series, options.base)
else:
base = None
- git.apply_patch(diff = diff, base = base, reject = options.reject,
- strip = options.strip)
+ try:
+ git.apply_patch(diff = diff, base = base, reject = options.reject,
+ strip = options.strip)
+ except git.GitException:
+ if not options.reject:
+ crt_series.delete_patch(patch)
+ raise
crt_series.refresh_patch(edit = options.edit,
show_patch = options.showdiff,
author_date = author_date,
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [StGit PATCH 4/5] Add the -p option to fold
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
` (2 preceding siblings ...)
2009-09-16 21:41 ` [StGit PATCH 3/5] Do not create an empty patch if import failed without --reject Catalin Marinas
@ 2009-09-16 21:41 ` Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 5/5] Autosign imported patches Catalin Marinas
4 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:41 UTC (permalink / raw)
To: Karl Hasselström, git
This option was added to import, so it makes sense for fold to have it
as well.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/fold.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/fold.py b/stgit/commands/fold.py
index 28e824c..ce0459e 100644
--- a/stgit/commands/fold.py
+++ b/stgit/commands/fold.py
@@ -39,6 +39,8 @@ options = [
short = 'Perform a three-way merge with the current patch'),
opt('-b', '--base', args = [argparse.commit],
short = 'Use BASE instead of HEAD when applying the patch'),
+ opt('-p', '--strip', type = 'int', metavar = 'N',
+ short = 'Remove N leading slashes from diff paths (default 1)'),
opt('--reject', action = 'store_true',
short = 'Leave the rejected hunks in corresponding *.rej files')]
@@ -75,11 +77,13 @@ def func(parser, options, args):
crt_patch = crt_series.get_patch(current)
bottom = crt_patch.get_bottom()
git.apply_patch(filename = filename, base = bottom,
- reject = options.reject)
+ strip = options.strip, reject = options.reject)
elif options.base:
git.apply_patch(filename = filename, reject = options.reject,
+ strip = options.strip,
base = git_id(crt_series, options.base))
else:
- git.apply_patch(filename = filename, reject = options.reject)
+ git.apply_patch(filename = filename, strip = options.strip,
+ reject = options.reject)
out.done()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [StGit PATCH 5/5] Autosign imported patches
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
` (3 preceding siblings ...)
2009-09-16 21:41 ` [StGit PATCH 4/5] Add the -p option to fold Catalin Marinas
@ 2009-09-16 21:41 ` Catalin Marinas
4 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2009-09-16 21:41 UTC (permalink / raw)
To: Karl Hasselström, git
If stgit.autosign configuration is set, allow the automatic signing of
the imported patches, similar to the 'new' command.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/imprt.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index de77635..0f78490 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -141,6 +141,10 @@ def __create_patch(filename, message, author_name, author_email,
if options.authdate:
author_date = options.authdate
+ sign_str = options.sign_str
+ if not options.sign_str:
+ sign_str = config.get('stgit.autosign')
+
crt_series.new_patch(patch, message = message, can_edit = False,
author_name = author_name,
author_email = author_email,
@@ -164,8 +168,7 @@ def __create_patch(filename, message, author_name, author_email,
crt_series.refresh_patch(edit = options.edit,
show_patch = options.showdiff,
author_date = author_date,
- sign_str = options.sign_str,
- backup = False)
+ sign_str = sign_str, backup = False)
out.done()
def __mkpatchname(name, suffix):
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-16 21:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 21:40 [StGit PATCH 0/5] More UI clean-up Catalin Marinas
2009-09-16 21:40 ` [StGit PATCH 1/5] Remove the 'fail_dump' argument to git.apply_patch() Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 2/5] Add the --reject option to fold Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 3/5] Do not create an empty patch if import failed without --reject Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 4/5] Add the -p option to fold Catalin Marinas
2009-09-16 21:41 ` [StGit PATCH 5/5] Autosign imported patches Catalin Marinas
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).