summaryrefslogtreecommitdiffstats
path: root/what-it-does
blob: cec9be1e382915b6de1ad8704d86dc1516a4ed0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Use:
	diff-remap-data <dir1> <dir2> >map
or
	git-remap-data <git-diff arguments> >map
will build information for remapper.

remap-log is a filter.  It takes map as argument and, in the simplest form,
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
<new-filename>:<new-number>:<text>
on the output.  If it hadn't, we get
<prefix><filename>:<number>:<text>
Lines that do not have such form are passed unchanged.  Default prefix
is "O:", but that can be changed by passing -o <prefix> in remap-log
arguments.

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 >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. 

Ability to change prefix is useful when we are doing multiple remappings.
E.g. after

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 -o newer: map2>foo

* lines that didn't make it into the newer tree will be marked with old:
  and otherwise left unchanged
* lines that made it to newer, but not the current will be marked with
  newer: and have the filenames/line numbers remapped to newer tree
* lines that made it all the way will be remapped all the way
  to current tree.

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.