{"thread":{"id":"9207","subject":"[StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved.","startedAt":"2007-07-24T18:57:25Z","lastAt":"2007-07-24T18:57:46Z","messageCount":5,"participants":["Yann Dirson"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"48498","messageId":"20070724185535.17180.24577.stgit@gandelf.nowhere.earth","threadId":"9207","inReplyTo":null,"subject":"[StGIT PATCH 0/4] stg-whatchanged improvements","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-07-24T18:57:25Z","receivedAt":"2007-07-24T18:57:25Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The following series fixes a case where contrib/stg-whatchanged did\nnot work as expected, and makes it use contrib/stg-mdiff instead of\nreimplementing the same logic.  Especially since stg-whatchanged had\nalready gained metadiff-related improvements that stg-mdiff did not\nhad :)\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"48497","messageId":"20070724185730.17180.87589.stgit@gandelf.nowhere.earth","threadId":"9207","inReplyTo":"20070724185535.17180.24577.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-07-24T18:57:30Z","receivedAt":"2007-07-24T18:57:30Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nThe most reliable way I found to decide if we were in the process of\nsolving a conflict, including when all conflicted files have already\nbeen marked resolved, is to check the latest patchlog entry.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-whatchanged |   10 ++++------\n 1 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged\nindex a416e97..231f4f5 100755\n--- a/contrib/stg-whatchanged\n+++ b/contrib/stg-whatchanged\n@@ -24,12 +24,10 @@ fi\n # Merges via \"push\" leave top=bottom so we must look at old patch\n # in this case (unlike, eg., \"pick --fold\")\n patchdir=\"$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)\"\n-if [ -s \"$(git-rev-parse --git-dir)/conflicts\" ];\n-then\n-    current_cmd=\"stg show //top.old\"\n-else\n-    current_cmd=\"stg show\"\n-fi\n+case $(stg log | head -n1) in\n+    *push\\(c\\)*) current_cmd=\"stg show //top.old\" ;;\n+    *) current_cmd=\"stg show\" ;;\n+esac\n \n colordiff \"$@\" \\\n     -I '^index [0-9a-b]*..[0-9a-b]*' \\\n"},{"id":"48500","messageId":"20070724185735.17180.36833.stgit@gandelf.nowhere.earth","threadId":"9207","inReplyTo":"20070724185535.17180.24577.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 2/4] Add range comparison support to stg-mdiff.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-07-24T18:57:35Z","receivedAt":"2007-07-24T18:57:35Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nWe can now compare arbitrary deltas, not just single commits.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-mdiff |   13 +++++++++++--\n 1 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/stg-mdiff b/contrib/stg-mdiff\nindex cd0c678..9bb324a 100755\n--- a/contrib/stg-mdiff\n+++ b/contrib/stg-mdiff\n@@ -12,7 +12,7 @@ set -e\n \n usage()\n {\n-    echo \"Usage: $(basename $0) <patch1> <patch2>\"\n+    echo \"Usage: $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>\"\n     exit 1\n }\n \n@@ -20,4 +20,13 @@ if [ \"$#\" != 2 ]; then\n     usage\n fi\n \n-colordiff -u <(stg show \"$1\") <(stg show \"$2\") | less -RFX\n+case \"$1\" in\n+*..*) cmd1=\"stg diff\" ;;\n+*)    cmd1=\"stg show\" ;;\n+esac\n+case \"$2\" in\n+*..*) cmd2=\"stg diff\" ;;\n+*)    cmd2=\"stg show\" ;;\n+esac\n+\n+colordiff -u <($cmd1 \"$1\") <($cmd2 \"$2\") | less -RFX\n"},{"id":"48501","messageId":"20070724185740.17180.72586.stgit@gandelf.nowhere.earth","threadId":"9207","inReplyTo":"20070724185535.17180.24577.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 3/4] Add to stg-mdiff the ability to pass options to underlying diff opts.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-07-24T18:57:41Z","receivedAt":"2007-07-24T18:57:41Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSo we now have -O, similar to the existing option in stg diff, to pass\nflags to git-diff when computing the 2 diffs to compare (-M, -C and -w\ncome to mind as being potentially useful here), and -o can be used to\ntune the invocation of diff on those 2 diffs.\n\nNote that -o is only there temporarily, and will disappear when a more\nsophisticated process than plain diff will be used.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-mdiff |   29 +++++++++++++++++++++++------\n 1 files changed, 23 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/stg-mdiff b/contrib/stg-mdiff\nindex 9bb324a..61cba9e 100755\n--- a/contrib/stg-mdiff\n+++ b/contrib/stg-mdiff\n@@ -12,21 +12,38 @@ set -e\n \n usage()\n {\n-    echo \"Usage: $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>\"\n+    echo \"Usage: [-o <diff-flags>] [-O <gitdiff-flags>] $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>\"\n     exit 1\n }\n \n+diffopts=\n+subdiffopts=\n+while [ \"$#\" -gt 0 ]; do\n+    case \"$1\" in\n+\t-o) diffopts=\"$2\"; shift ;;\n+\t-O) subdiffopts=\"-O $2\"; shift ;;\n+\t-*) usage ;;\n+\t*) break ;;\n+    esac\n+    shift\n+done\n+\n if [ \"$#\" != 2 ]; then\n     usage\n fi\n \n+if [ -z \"$diffopts\" ]; then\n+    diffopts=\"-u\"\n+fi\n+\n case \"$1\" in\n-*..*) cmd1=\"stg diff\" ;;\n-*)    cmd1=\"stg show\" ;;\n+*..*) cmd1=\"stg diff $subdiffopts -r\" ;;\n+*)    cmd1=\"stg show $subdiffopts\" ;;\n esac\n case \"$2\" in\n-*..*) cmd2=\"stg diff\" ;;\n-*)    cmd2=\"stg show\" ;;\n+*..*) cmd2=\"stg diff $subdiffopts -r\" ;;\n+*)    cmd2=\"stg show $subdiffopts\" ;;\n esac\n \n-colordiff -u <($cmd1 \"$1\") <($cmd2 \"$2\") | less -RFX\n+colordiff $diffopts \\\n+    <($cmd1 \"$1\") <($cmd2 \"$2\") | less -RFX\n"},{"id":"48499","messageId":"20070724185746.17180.29218.stgit@gandelf.nowhere.earth","threadId":"9207","inReplyTo":"20070724185535.17180.24577.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 4/4] Port stg-whatchanged improvements to stg-mdiff and have the former use the latter.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-07-24T18:57:46Z","receivedAt":"2007-07-24T18:57:46Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-mdiff       |    2 ++\n contrib/stg-whatchanged |   10 ++++------\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/stg-mdiff b/contrib/stg-mdiff\nindex 61cba9e..74d7f77 100755\n--- a/contrib/stg-mdiff\n+++ b/contrib/stg-mdiff\n@@ -46,4 +46,6 @@ case \"$2\" in\n esac\n \n colordiff $diffopts \\\n+    -I '^index [0-9a-b]*..[0-9a-b]*' \\\n+    -I '^@@ .* @@' \\\n     <($cmd1 \"$1\") <($cmd2 \"$2\") | less -RFX\ndiff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged\nindex 231f4f5..afeda2c 100755\n--- a/contrib/stg-whatchanged\n+++ b/contrib/stg-whatchanged\n@@ -25,11 +25,9 @@ fi\n # in this case (unlike, eg., \"pick --fold\")\n patchdir=\"$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)\"\n case $(stg log | head -n1) in\n-    *push\\(c\\)*) current_cmd=\"stg show //top.old\" ;;\n-    *) current_cmd=\"stg show\" ;;\n+    *push\\(c\\)*) former=\"//top.old\" ;;\n+    *) former=\"//top\" ;;\n esac\n \n-colordiff \"$@\" \\\n-    -I '^index [0-9a-b]*..[0-9a-b]*' \\\n-    -I '^@@ .* @@' \\\n-    <($current_cmd) <(stg diff -r//bottom) | less -RFX\n+stg-mdiff -o \"$*\" \\\n+    $former //bottom..\n"}]}