From 3371f9b3fb13a508c447e484618b9b5e2b9e45a7 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 27 Mar 2011 13:13:22 -0500 Subject: Makefile: list one vcs-svn/xdiff object or header per line As the svn import infrastructure evolves, it's getting to be a pain to tell by eye what files were added or removed from a dependency line like VCSSVN_OBJS = vcs-svn/string_pool.o vcs-svn/line_buffer.o \ vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o So use a style with one entry per line instead, like the existing BUILTIN_OBJS: # protect against environment VCSSVN_OBJS = ... VCSSVN_OBJS += vcs-svn/string_pool.o VCSSVN_OBJS += vcs-svn/line_buffer.o ... which is readable on its own and produces nice, clear diffs. Signed-off-by: Jonathan Nieder --- Makefile | 60 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 16 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ade79232f4..dd1af362c7 100644 --- a/Makefile +++ b/Makefile @@ -341,6 +341,11 @@ BUILTIN_OBJS = BUILT_INS = COMPAT_CFLAGS = COMPAT_OBJS = +XDIFF_H = +XDIFF_OBJS = +VCSSVN_H = +VCSSVN_OBJS = +VCSSVN_TEST_OBJS = EXTRA_CPPFLAGS = LIB_H = LIB_OBJS = @@ -1836,12 +1841,25 @@ GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \ ifndef NO_CURL GIT_OBJS += http.o http-walker.o remote-curl.o endif -XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \ - xdiff/xmerge.o xdiff/xpatience.o -VCSSVN_OBJS = vcs-svn/string_pool.o vcs-svn/line_buffer.o \ - vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o -VCSSVN_TEST_OBJS = test-obj-pool.o test-string-pool.o \ - test-line-buffer.o test-treap.o + +XDIFF_OBJS += xdiff/xdiffi.o +XDIFF_OBJS += xdiff/xprepare.o +XDIFF_OBJS += xdiff/xutils.o +XDIFF_OBJS += xdiff/xemit.o +XDIFF_OBJS += xdiff/xmerge.o +XDIFF_OBJS += xdiff/xpatience.o + +VCSSVN_OBJS += vcs-svn/string_pool.o +VCSSVN_OBJS += vcs-svn/line_buffer.o +VCSSVN_OBJS += vcs-svn/repo_tree.o +VCSSVN_OBJS += vcs-svn/fast_export.o +VCSSVN_OBJS += vcs-svn/svndump.o + +VCSSVN_TEST_OBJS += test-obj-pool.o +VCSSVN_TEST_OBJS += test-string-pool.o +VCSSVN_TEST_OBJS += test-line-buffer.o +VCSSVN_TEST_OBJS += test-treap.o + OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS) dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) @@ -1960,16 +1978,26 @@ connect.o transport.o http-backend.o: url.h http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h -xdiff-interface.o $(XDIFF_OBJS): \ - xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \ - xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h - -$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \ - vcs-svn/obj_pool.h vcs-svn/trp.h vcs-svn/string_pool.h \ - vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \ - vcs-svn/svndump.h - -test-svn-fe.o: vcs-svn/svndump.h +XDIFF_H += xdiff/xinclude.h +XDIFF_H += xdiff/xmacros.h +XDIFF_H += xdiff/xdiff.h +XDIFF_H += xdiff/xtypes.h +XDIFF_H += xdiff/xutils.h +XDIFF_H += xdiff/xprepare.h +XDIFF_H += xdiff/xdiffi.h +XDIFF_H += xdiff/xemit.h + +xdiff-interface.o $(XDIFF_OBJS): $(XDIFF_H) + +VCSSVN_H += vcs-svn/obj_pool.h +VCSSVN_H += vcs-svn/trp.h +VCSSVN_H += vcs-svn/string_pool.h +VCSSVN_H += vcs-svn/line_buffer.h +VCSSVN_H += vcs-svn/repo_tree.h +VCSSVN_H += vcs-svn/fast_export.h +VCSSVN_H += vcs-svn/svndump.h + +$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) $(VCSSVN_H) endif exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \ -- cgit v1.2.3 From 9d2f5ddfe56fcc228a36dd079f0897e0f474eb4e Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 2 Jan 2011 21:54:58 -0600 Subject: vcs-svn: learn to maintain a sliding view of a file Each section of a Subversion-format delta only requires examining (and keeping in random-access memory) a small portion of the preimage. At any moment, this portion starts at a certain file offset and has a well-defined length, and as the delta is applied, the portion advances from the beginning to the end of the preimage. Add a move_window function to keep track of this view into the preimage. You can use it like this: buffer_init(f, NULL); struct sliding_view window = SLIDING_VIEW_INIT(f); move_window(&window, 3, 7); /* (1) */ move_window(&window, 5, 5); /* (2) */ move_window(&window, 12, 2); /* (3) */ strbuf_release(&window.buf); buffer_deinit(f); The data structure is called sliding_view instead of _window to prevent confusion with svndiff0 Windows. In this example, (1) reads 10 bytes and discards the first 3; (2) discards the first 2, which are not needed any more; and (3) skips 2 bytes and reads 2 new bytes to work with. When move_window returns, the file position indicator is at position window->off + window->width and the data from positions window->off to the current file position are stored in window->buf. This function performs only sequential access from the input file and never seeks, so it can be safely used on pipes and sockets. On end-of-file, move_window silently reads less than the caller requested. On other errors, it prints a message and returns -1. Helped-by: David Barr Signed-off-by: Jonathan Nieder --- Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index dd1af362c7..5cd141d5af 100644 --- a/Makefile +++ b/Makefile @@ -1851,6 +1851,7 @@ XDIFF_OBJS += xdiff/xpatience.o VCSSVN_OBJS += vcs-svn/string_pool.o VCSSVN_OBJS += vcs-svn/line_buffer.o +VCSSVN_OBJS += vcs-svn/sliding_window.o VCSSVN_OBJS += vcs-svn/repo_tree.o VCSSVN_OBJS += vcs-svn/fast_export.o VCSSVN_OBJS += vcs-svn/svndump.o @@ -1993,6 +1994,7 @@ VCSSVN_H += vcs-svn/obj_pool.h VCSSVN_H += vcs-svn/trp.h VCSSVN_H += vcs-svn/string_pool.h VCSSVN_H += vcs-svn/line_buffer.h +VCSSVN_H += vcs-svn/sliding_window.h VCSSVN_H += vcs-svn/repo_tree.h VCSSVN_H += vcs-svn/fast_export.h VCSSVN_H += vcs-svn/svndump.h -- cgit v1.2.3 From ddcc8c5b469d2564dbacd629a873e7703f2dbd83 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 25 Dec 2010 05:11:32 -0600 Subject: vcs-svn: skeleton of an svn delta parser A delta in the subversion delta (svndiff0) format consists of the magic bytes SVN\0 followed by a sequence of windows of a certain well specified format (starting with five integers). Add an svndiff0_apply function and test-svn-fe -d commandline tool to parse such a delta in the special case of not including any windows. Later patches will add features to turn this into a fully functional delta applier for svn-fe to use to parse the streams produced by "svnrdump dump" and "svnadmin dump --deltas". The content of symlinks starts with the word "link " in Subversion's worldview, so we need to be able to prepend that text to input for the sake of delta application. So initialization of the input state of the delta preimage is left to the calling program, giving callers a chance to seed the buffer with text of their choice. Improved-by: Ramkumar Ramachandra Improved-by: David Barr Signed-off-by: Jonathan Nieder --- Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5cd141d5af..cd7dd9723d 100644 --- a/Makefile +++ b/Makefile @@ -1854,6 +1854,7 @@ VCSSVN_OBJS += vcs-svn/line_buffer.o VCSSVN_OBJS += vcs-svn/sliding_window.o VCSSVN_OBJS += vcs-svn/repo_tree.o VCSSVN_OBJS += vcs-svn/fast_export.o +VCSSVN_OBJS += vcs-svn/svndiff.o VCSSVN_OBJS += vcs-svn/svndump.o VCSSVN_TEST_OBJS += test-obj-pool.o @@ -1997,6 +1998,7 @@ VCSSVN_H += vcs-svn/line_buffer.h VCSSVN_H += vcs-svn/sliding_window.h VCSSVN_H += vcs-svn/repo_tree.h VCSSVN_H += vcs-svn/fast_export.h +VCSSVN_H += vcs-svn/svndiff.h VCSSVN_H += vcs-svn/svndump.h $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) $(VCSSVN_H) -- cgit v1.2.3