gitk: Improve cherry-pick error handling
This adds to the regexps that are used to work out what sort of error we encountered in trying to do a cherry-pick so that it recognizes some additional common error messages. It adds a confirmation dialog when the error is a merge conflict so the user can choose whether or not to run git citool. Finally, it arranges to update the display after a cherry-pick failed so that any local changes made by the cherry-pick become visible. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Nov 8, 2008 at 21:37 UTC
887a791f113a09a56bb4916243463481a51d86a4
1 file changed
+16
-9
gitk
+16
-9
@@ -8133,18 +8133,25 @@ proc cherrypick {} {
8133
if {[catch {exec sh -c "git cherry-pick -r $rowmenuid 2>&1"} err]} {
8134
notbusy cherrypick
8135
if {[regexp -line \
8136
- {Entry '(.*)' would be overwritten by merge} $err msg fname]} {
8137
- error_popup [mc "Cherry-pick failed:
8138
-file '%s' had local modifications.
8139
-
8140
-Please commit, reset or stash your changes." $fname]
8141
- } elseif {[regexp -line {^CONFLICT \(.*\):} $err msg]} {
8142
- # Force citool to read MERGE_MSG
8143
- file delete [file join [gitdir] "GITGUI_MSG"]
8144
- exec_citool {} $rowmenuid
8136
+ {Entry '(.*)' (would be overwritten by merge|not uptodate)} \
8137
+ $err msg fname]} {
8138
+ error_popup [mc "Cherry-pick failed because of local changes\
8139
+ to file '%s'.\nPlease commit, reset or stash\
8140
+ your changes and try again." $fname]
8141
+ } elseif {[regexp -line \
8142
+ {^(CONFLICT \(.*\):|Automatic cherry-pick failed)} \
8143
+ $err]} {
8144
+ if {[confirm_popup [mc "Cherry-pick failed because of merge\
8145
+ conflict.\nDo you wish to run git citool to\
8146
+ resolve it?"]]} {
8147
+ # Force citool to read MERGE_MSG
8148
+ file delete [file join [gitdir] "GITGUI_MSG"]
8149
+ exec_citool {} $rowmenuid
8150
+ }
8151
} else {
8152
error_popup $err
8153
}
8154
+ run updatecommits
8155
return
8156
}
8157
set newhead [exec git rev-parse HEAD]