sapling/eden/scm/lib/linelog/Makefile

12 lines
208 B
Makefile
Raw Normal View History

linelogcli: a simple CLI tool for linelog Summary: The `linelogcli` tool exposes linelog APIs to command line: - `linelogcli file init`: create a linelog file - `linelogcli file annotate rev`: run annotate - `linelogcli file replacelines rev a1:a2 b1:b2`: replace lines - `linelogcli file info`: show maxrev and buffer size - `linelogcli file dump`: dump human-readable instructions It's designed for (fuzz) testing, memory leak checking. It's also a basic tool for developers to investigate a linelog file. It's not designed for end users and we will have a separate Python wrapper implemented in Cython for mercurial integration. Therefore reviewers are recommended to be less strict for this implementation. Test Plan: `make` and test some basic operations: ``` $ ./linelogcli /tmp/foo init annotate 0 replacelines 1 0:0 0:4 annotate - replacelines 2 1:2 10:13 annotate - replacelines 3 2:6 20:22 annotate - replacelines 4 0:4 30:31 annotate - annotate 2 info dump init: okay annotate: run annotate for rev 0 annotate: 0 lines, endoffset 1 replacelines: rev 1, lines 0:0 -> 0:4 annotate: 4 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 1, ln 1, offset 4 2: rev 1, ln 2, offset 5 3: rev 1, ln 3, offset 6 replacelines: rev 2, lines 1:2 -> 10:13 annotate: 6 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 2, ln 10, offset 9 2: rev 2, ln 11, offset 10 3: rev 2, ln 12, offset 11 4: rev 1, ln 2, offset 5 5: rev 1, ln 3, offset 6 replacelines: rev 3, lines 2:6 -> 20:22 annotate: 4 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 2, ln 10, offset 9 2: rev 3, ln 20, offset 16 3: rev 3, ln 21, offset 17 replacelines: rev 4, lines 0:4 -> 30:31 annotate: 1 lines, endoffset 7 0: rev 4, ln 30, offset 22 annotate: run annotate for rev 2 annotate: 6 lines, endoffset 7 0: rev 1, ln 0, offset 24 1: rev 2, ln 10, offset 9 2: rev 2, ln 11, offset 19 3: rev 2, ln 12, offset 11 4: rev 1, ln 2, offset 5 5: rev 1, ln 3, offset 6 info: maxrev = 4, size = 208 dump: 1: J 2 2: JL 1 7 3: J 21 4: J 8 5: LINE 1 2 6: LINE 1 3 7: END 8: JL 2 12 9: LINE 2 10 10: J 15 11: LINE 2 12 12: JGE 2 5 13: LINE 1 1 14: J 5 15: JL 3 18 16: LINE 3 20 17: LINE 3 21 18: JGE 3 7 19: LINE 2 11 20: J 11 21: JL 4 23 22: LINE 4 30 23: JGE 4 7 24: LINE 1 0 25: J 4 ``` Also run with `valgrind --tool=memcheck --leak-check=yes` to make sure there is no memory leak. Reviewers: #mercurial, simonfar Reviewed By: simonfar Subscribers: simonfar, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3645102 Signature: t1:3645102:1470335856:860a7dbb1781f6fe1e11e235ad163e2fbb6d45b2
2016-07-30 14:59:17 +03:00
.PHONY: all clean
CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Wconversion -pedantic -g
linelogcli: a simple CLI tool for linelog Summary: The `linelogcli` tool exposes linelog APIs to command line: - `linelogcli file init`: create a linelog file - `linelogcli file annotate rev`: run annotate - `linelogcli file replacelines rev a1:a2 b1:b2`: replace lines - `linelogcli file info`: show maxrev and buffer size - `linelogcli file dump`: dump human-readable instructions It's designed for (fuzz) testing, memory leak checking. It's also a basic tool for developers to investigate a linelog file. It's not designed for end users and we will have a separate Python wrapper implemented in Cython for mercurial integration. Therefore reviewers are recommended to be less strict for this implementation. Test Plan: `make` and test some basic operations: ``` $ ./linelogcli /tmp/foo init annotate 0 replacelines 1 0:0 0:4 annotate - replacelines 2 1:2 10:13 annotate - replacelines 3 2:6 20:22 annotate - replacelines 4 0:4 30:31 annotate - annotate 2 info dump init: okay annotate: run annotate for rev 0 annotate: 0 lines, endoffset 1 replacelines: rev 1, lines 0:0 -> 0:4 annotate: 4 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 1, ln 1, offset 4 2: rev 1, ln 2, offset 5 3: rev 1, ln 3, offset 6 replacelines: rev 2, lines 1:2 -> 10:13 annotate: 6 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 2, ln 10, offset 9 2: rev 2, ln 11, offset 10 3: rev 2, ln 12, offset 11 4: rev 1, ln 2, offset 5 5: rev 1, ln 3, offset 6 replacelines: rev 3, lines 2:6 -> 20:22 annotate: 4 lines, endoffset 7 0: rev 1, ln 0, offset 3 1: rev 2, ln 10, offset 9 2: rev 3, ln 20, offset 16 3: rev 3, ln 21, offset 17 replacelines: rev 4, lines 0:4 -> 30:31 annotate: 1 lines, endoffset 7 0: rev 4, ln 30, offset 22 annotate: run annotate for rev 2 annotate: 6 lines, endoffset 7 0: rev 1, ln 0, offset 24 1: rev 2, ln 10, offset 9 2: rev 2, ln 11, offset 19 3: rev 2, ln 12, offset 11 4: rev 1, ln 2, offset 5 5: rev 1, ln 3, offset 6 info: maxrev = 4, size = 208 dump: 1: J 2 2: JL 1 7 3: J 21 4: J 8 5: LINE 1 2 6: LINE 1 3 7: END 8: JL 2 12 9: LINE 2 10 10: J 15 11: LINE 2 12 12: JGE 2 5 13: LINE 1 1 14: J 5 15: JL 3 18 16: LINE 3 20 17: LINE 3 21 18: JGE 3 7 19: LINE 2 11 20: J 11 21: JL 4 23 22: LINE 4 30 23: JGE 4 7 24: LINE 1 0 25: J 4 ``` Also run with `valgrind --tool=memcheck --leak-check=yes` to make sure there is no memory leak. Reviewers: #mercurial, simonfar Reviewed By: simonfar Subscribers: simonfar, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3645102 Signature: t1:3645102:1470335856:860a7dbb1781f6fe1e11e235ad163e2fbb6d45b2
2016-07-30 14:59:17 +03:00
all: linelogcli
linelogcli: linelogcli.c linelog.c linelog.h
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f linelogcli