git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGIT PATCH 0/4] stg-whatchanged improvements
@ 2007-07-24 18:57 Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved Yann Dirson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yann Dirson @ 2007-07-24 18:57 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

The following series fixes a case where contrib/stg-whatchanged did
not work as expected, and makes it use contrib/stg-mdiff instead of
reimplementing the same logic.  Especially since stg-whatchanged had
already gained metadiff-related improvements that stg-mdiff did not
had :)

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved.
  2007-07-24 18:57 [StGIT PATCH 0/4] stg-whatchanged improvements Yann Dirson
@ 2007-07-24 18:57 ` Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 2/4] Add range comparison support to stg-mdiff Yann Dirson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2007-07-24 18:57 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Yann Dirson <yann.dirson@sagem.com>

The most reliable way I found to decide if we were in the process of
solving a conflict, including when all conflicted files have already
been marked resolved, is to check the latest patchlog entry.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-whatchanged |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged
index a416e97..231f4f5 100755
--- a/contrib/stg-whatchanged
+++ b/contrib/stg-whatchanged
@@ -24,12 +24,10 @@ fi
 # Merges via "push" leave top=bottom so we must look at old patch
 # in this case (unlike, eg., "pick --fold")
 patchdir="$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)"
-if [ -s "$(git-rev-parse --git-dir)/conflicts" ];
-then
-    current_cmd="stg show //top.old"
-else
-    current_cmd="stg show"
-fi
+case $(stg log | head -n1) in
+    *push\(c\)*) current_cmd="stg show //top.old" ;;
+    *) current_cmd="stg show" ;;
+esac
 
 colordiff "$@" \
     -I '^index [0-9a-b]*..[0-9a-b]*' \

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [StGIT PATCH 2/4] Add range comparison support to stg-mdiff.
  2007-07-24 18:57 [StGIT PATCH 0/4] stg-whatchanged improvements Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved Yann Dirson
@ 2007-07-24 18:57 ` Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 3/4] Add to stg-mdiff the ability to pass options to underlying diff opts Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 4/4] Port stg-whatchanged improvements to stg-mdiff and have the former use the latter Yann Dirson
  3 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2007-07-24 18:57 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Yann Dirson <yann.dirson@sagem.com>

We can now compare arbitrary deltas, not just single commits.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-mdiff |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/contrib/stg-mdiff b/contrib/stg-mdiff
index cd0c678..9bb324a 100755
--- a/contrib/stg-mdiff
+++ b/contrib/stg-mdiff
@@ -12,7 +12,7 @@ set -e
 
 usage()
 {
-    echo "Usage: $(basename $0) <patch1> <patch2>"
+    echo "Usage: $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>"
     exit 1
 }
 
@@ -20,4 +20,13 @@ if [ "$#" != 2 ]; then
     usage
 fi
 
-colordiff -u <(stg show "$1") <(stg show "$2") | less -RFX
+case "$1" in
+*..*) cmd1="stg diff" ;;
+*)    cmd1="stg show" ;;
+esac
+case "$2" in
+*..*) cmd2="stg diff" ;;
+*)    cmd2="stg show" ;;
+esac
+
+colordiff -u <($cmd1 "$1") <($cmd2 "$2") | less -RFX

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [StGIT PATCH 3/4] Add to stg-mdiff the ability to pass options to underlying diff opts.
  2007-07-24 18:57 [StGIT PATCH 0/4] stg-whatchanged improvements Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 2/4] Add range comparison support to stg-mdiff Yann Dirson
@ 2007-07-24 18:57 ` Yann Dirson
  2007-07-24 18:57 ` [StGIT PATCH 4/4] Port stg-whatchanged improvements to stg-mdiff and have the former use the latter Yann Dirson
  3 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2007-07-24 18:57 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Yann Dirson <yann.dirson@sagem.com>

So we now have -O, similar to the existing option in stg diff, to pass
flags to git-diff when computing the 2 diffs to compare (-M, -C and -w
come to mind as being potentially useful here), and -o can be used to
tune the invocation of diff on those 2 diffs.

Note that -o is only there temporarily, and will disappear when a more
sophisticated process than plain diff will be used.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-mdiff |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/contrib/stg-mdiff b/contrib/stg-mdiff
index 9bb324a..61cba9e 100755
--- a/contrib/stg-mdiff
+++ b/contrib/stg-mdiff
@@ -12,21 +12,38 @@ set -e
 
 usage()
 {
-    echo "Usage: $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>"
+    echo "Usage: [-o <diff-flags>] [-O <gitdiff-flags>] $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>"
     exit 1
 }
 
+diffopts=
+subdiffopts=
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+	-o) diffopts="$2"; shift ;;
+	-O) subdiffopts="-O $2"; shift ;;
+	-*) usage ;;
+	*) break ;;
+    esac
+    shift
+done
+
 if [ "$#" != 2 ]; then
     usage
 fi
 
+if [ -z "$diffopts" ]; then
+    diffopts="-u"
+fi
+
 case "$1" in
-*..*) cmd1="stg diff" ;;
-*)    cmd1="stg show" ;;
+*..*) cmd1="stg diff $subdiffopts -r" ;;
+*)    cmd1="stg show $subdiffopts" ;;
 esac
 case "$2" in
-*..*) cmd2="stg diff" ;;
-*)    cmd2="stg show" ;;
+*..*) cmd2="stg diff $subdiffopts -r" ;;
+*)    cmd2="stg show $subdiffopts" ;;
 esac
 
-colordiff -u <($cmd1 "$1") <($cmd2 "$2") | less -RFX
+colordiff $diffopts \
+    <($cmd1 "$1") <($cmd2 "$2") | less -RFX

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [StGIT PATCH 4/4] Port stg-whatchanged improvements to stg-mdiff and have the former use the latter.
  2007-07-24 18:57 [StGIT PATCH 0/4] stg-whatchanged improvements Yann Dirson
                   ` (2 preceding siblings ...)
  2007-07-24 18:57 ` [StGIT PATCH 3/4] Add to stg-mdiff the ability to pass options to underlying diff opts Yann Dirson
@ 2007-07-24 18:57 ` Yann Dirson
  3 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2007-07-24 18:57 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Yann Dirson <yann.dirson@sagem.com>

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-mdiff       |    2 ++
 contrib/stg-whatchanged |   10 ++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/stg-mdiff b/contrib/stg-mdiff
index 61cba9e..74d7f77 100755
--- a/contrib/stg-mdiff
+++ b/contrib/stg-mdiff
@@ -46,4 +46,6 @@ case "$2" in
 esac
 
 colordiff $diffopts \
+    -I '^index [0-9a-b]*..[0-9a-b]*' \
+    -I '^@@ .* @@' \
     <($cmd1 "$1") <($cmd2 "$2") | less -RFX
diff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged
index 231f4f5..afeda2c 100755
--- a/contrib/stg-whatchanged
+++ b/contrib/stg-whatchanged
@@ -25,11 +25,9 @@ fi
 # in this case (unlike, eg., "pick --fold")
 patchdir="$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)"
 case $(stg log | head -n1) in
-    *push\(c\)*) current_cmd="stg show //top.old" ;;
-    *) current_cmd="stg show" ;;
+    *push\(c\)*) former="//top.old" ;;
+    *) former="//top" ;;
 esac
 
-colordiff "$@" \
-    -I '^index [0-9a-b]*..[0-9a-b]*' \
-    -I '^@@ .* @@' \
-    <($current_cmd) <(stg diff -r//bottom) | less -RFX
+stg-mdiff -o "$*" \
+    $former //bottom..

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-24 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 18:57 [StGIT PATCH 0/4] stg-whatchanged improvements Yann Dirson
2007-07-24 18:57 ` [StGIT PATCH 1/4] Fix stg-whatchanged to deal with conflicts already solved Yann Dirson
2007-07-24 18:57 ` [StGIT PATCH 2/4] Add range comparison support to stg-mdiff Yann Dirson
2007-07-24 18:57 ` [StGIT PATCH 3/4] Add to stg-mdiff the ability to pass options to underlying diff opts Yann Dirson
2007-07-24 18:57 ` [StGIT PATCH 4/4] Port stg-whatchanged improvements to stg-mdiff and have the former use the latter Yann Dirson

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 NNTP newsgroup(s).