diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-07-27 06:12:38 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-07-27 06:12:38 -0400 |
commit | 0c46ccdaddf63ae03558110749aad5303b2c52d3 (patch) | |
tree | 3a0b3b77b9d5c34cd1f8f71af111336254620a68 | |
parent | a6d59b2238d465f4d785cfe7172cec247604832b (diff) | |
download | remap-0c46ccdaddf63ae03558110749aad5303b2c52d3.tar.gz |
switch to saner defaults
Change default new prefix to "", update documentation.
Get git-remap-data in line with diff-remap-data
-rwxr-xr-x | git-remap-data | 2 | ||||
-rw-r--r-- | remap-log.c | 2 | ||||
-rw-r--r-- | what-it-does | 20 |
3 files changed, 13 insertions, 11 deletions
diff --git a/git-remap-data b/git-remap-data index e7a887d..7c85700 100755 --- a/git-remap-data +++ b/git-remap-data @@ -1,2 +1,2 @@ #!/bin/sh -GIT_DIFF_OPTS="-u 0" git diff -M "$@" +GIT_DIFF_OPTS="-u 0" git diff -M "$@"|remap-log diff --git a/remap-log.c b/remap-log.c index e8dacf0..c8c2691 100644 --- a/remap-log.c +++ b/remap-log.c @@ -30,7 +30,7 @@ #include <limits.h> char *prefix1 = "a/", *prefix2 = "b/"; -char *from_prefix = "", *old_prefix = "O:", *new_prefix = "N:"; +char *from_prefix = "", *old_prefix = "O:", *new_prefix = ""; size_t from_len = 0; char *line; diff --git a/what-it-does b/what-it-does index f0030d5..f6d29f7 100644 --- a/what-it-does +++ b/what-it-does @@ -9,19 +9,16 @@ will look at the lines in stdin that have form <filename>:<number>:<text> If the indicated line from old tree had survived into the new one, we will get -N:<new-filename>:<new-number>:<text> +<new-filename>:<new-number>:<text> on the output. If it hadn't, we get O:<filename>:<number>:<text> Lines that do not have such form are passed unchanged. Even that is already very useful for log comparison. E.g. if old-log is from the old tree and new-log is from the new one, we can do - remap-log map <old-log >foo - remap-log /dev/null <new-log >bar - diff -u foo bar -and have the noise due to line number changes excluded (empty map means -identity mapping, so the second line will simply slap N: on all lines of -form <filename>:<number>:<text> in new-log). + remap-log map <old-log >remapped-log + diff -u remapped-log new-log +and have the noise due to line number changes excluded. Note that it's not just for build logs; the thing is useful for sparse logs, grep -n output, etc., etc. @@ -33,12 +30,12 @@ and replace them with <prefix_for_new><new-filename>:<new-number>:<text> or <prefix_for_old><filename>:<number>:<text> -Defaults are "", "N:" and "O:" resp.; what it gives us is the ability to +Defaults are "", "" and "O:" resp.; what it gives us is the ability to do multiple remappings. IOW, we can say diff-remap-data old-tree newer-tree > map1 diff-remap-data newer-tree current-tree > map2 -remap-log -o old: map1 <old-log | remap-log -p N: -o newer: -N current: map2>foo +remap-log -o old: map1 <old-log | remap-log -o newer: -n current: map2>foo and get lines that didn't make it into the newer tree marked with old: and otherwise be unchanged, ones that made it to newer, but not the current to @@ -50,3 +47,8 @@ That's quite useful when you want to carry logs for a while, basically using them as annotated TODO ("logs" here can very well be results of grep -n with annotations added to them). You can have all still relevant bits stay with the locations in text and see what had fallen out. + +Note on relation to git: only git-remap-data needs it. Aside of working on +revisions in git repository instead of a couple of directory trees, it +generates slightly better map than diff-remap-data does. I.e. it manages +to remap more lines - it does notice renames. |