diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..f09d98dde9597de75ffcdb237c2b580b8fffa3f9 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,13 @@ +### 该问题是怎么引起的? + + + +### 重现步骤 + + + +### 报错信息 + + + + diff --git a/.gitignore b/.gitignore index d06998237482e5768c4d084e8a8de19908ce776e..3ee736248bf042da7582992ced6104717dc55c4e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,35 @@ svn-fast-export svn-ls-tree t/test-results t/trash* +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/Make.sh b/Make.sh new file mode 100644 index 0000000000000000000000000000000000000000..615cfee5dc606ef8f59683ae33546fc2c15f159c --- /dev/null +++ b/Make.sh @@ -0,0 +1,9 @@ +#!/bin/bash +mkdir -p bin +for dllfile in $(ldd svn-fast-export.exe|awk '{print $3}'|grep dll) +do +#echo $dllfile +cp $dllfile bin/ +done + +make && make install \ No newline at end of file diff --git a/Makefile b/Makefile index 59b7a4eeb5b09fdb6054dfac282c4ba282e94f45..e86ea60203ac94050618f18fbab34dd7689a00f9 100644 --- a/Makefile +++ b/Makefile @@ -19,22 +19,24 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -CC ?= cc +CC = /usr/bin/gcc INSTALL = install RM = rm -f -PREFIX ?= $(HOME) -CFLAGS = -g -O2 -Wall -std=c99 -CXXFLAGS=-std=c++11 -g -O2 -Wall +PREFIX ?= $(HOME)/git-svn-fast-import/ +CFLAGS = -g -O2 -Wall -std=c99 -D__CYGWIN__ +CXXFLAGS=-std=c++11 -g -O2 -Wall -D__CYGWIN__ -D__machine_mbstate_t_defined CPPFLAGS ?= LDFLAGS ?= -rdynamic EXTLIBS = -lapr-1 -lsvn_fs-1 -lsvn_repos-1 -lsvn_subr-1 -lstdc++ - +CPPFLAGS +=-I/usr/include/ -include config.mak include uname.mak APR_INCLUDES := $(shell apr-1-config --includes) APR_CPPFLAGS := $(shell apr-1-config --cppflags) -CPPFLAGS +=$(APR_INCLUDES) $(APR_CPPFLAGS) +CPPFLAGS +=$(APR_INCLUDES) $(APR_CPPFLAGS) + + GIT_SVN_FAST_IMPORT := git-svn-fast-import GIT_SVN_VERIFY_IMPORT := git-svn-verify-import diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..ed50a2d75502bf6b4d058efc58b71c90bd4172ef --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# git-svn-fast-import + +#### Description +移植导windows下的快速svn导入git工具,并修改支持-B path 只导入svn大仓库中的指定目录 + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index d364ea36f7370fed22edf72e116befc30577b47b..035983dfea428853d7f9fa509975e140e8850be4 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,21 @@ -# git-svn-fast-import +#### 介绍 +移植导windows下的快速svn导入git工具,并修改支持-B path 只导入svn大仓库中的指定目录 -[![Build Status](https://travis-ci.org/satori/git-svn-fast-import.svg?branch=master)](https://travis-ci.org/satori/git-svn-fast-import) +原作者地址: +[git-svn-fast-import](https://travis-ci.org/satori/git-svn-fast-import) -*git-svn-fast-import* is a toolset for fast Subversion-to-Git conversion. +#### 软件架构 +软件架构说明 -*svn-fast-export* is Subversion dump utility. -It features: -* branch history support -* multi-branch SVN revisions support -* SVN committer to Git author mapping +#### 安装教程 -*svn-ls-tree* is Subversion equivalent of Git's ls-tree command. +1. 安装mingw32环境 +2. ./make.sh -It tries to mimic git ls-tree behaviour: - -* computes blob/tree checksums the same way as Git; -* skips empty directories; -* outputs in the same format as Git. - -## Installation - -Use the `make` command: - - $ export PREFIX=$HOME/opt - $ make - $ make install - -## Requirements - -* [Apache Portable Runtime](https://apr.apache.org/) >= 1.5 -* [Subversion](https://subversion.apache.org/) >= 1.9 -* [Git](http://git-scm.com/) >= 2.1.2 - -## Example +#### 使用说明 +1. 原功能 $ mkdir -p repo.git && cd repo.git $ git init $ git-svn-fast-import --stdlayout -r 0:100000 /path/to/svnrepo @@ -45,10 +26,23 @@ Use the `make` command: ... progress Imported revision 99999 progress Imported revision 100000 + +2. 导指定目录 + $ git-svn-fast-import -B svndir -r 0:100000 /path/to/svnrepo + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request -## Copyright -Copyright (C) 2014-2015 by Maxim Bublis . +#### 特技 -*git-svn-fast-import* released under MIT License. -See [LICENSE](https://github.com/satori/git-svn-fast-import/blob/master/LICENSE) for details. +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/author.c b/author.c index 743a50dcea664f51ee1784cfde15140900eb9814..8d768eb453e3e5b814701f47fbcdd7fe5c52d119 100644 --- a/author.c +++ b/author.c @@ -59,12 +59,13 @@ author_storage_t *author_storage_create(apr_pool_t *pool) { const author_t *author_storage_lookup(const author_storage_t *as, const char *name) { author_t *author; - + + // printf("user: %s\n", name); author = svn_hash_gets(as->authors, name); if (author == NULL) { author = apr_pcalloc(as->pool, sizeof(author_t)); author->svn_name = apr_pstrdup(as->pool, name); - author->name = UNKNOWN; + author->name = apr_pstrdup(as->pool, name); author->email = apr_psprintf(as->pool, "%s@" UNKNOWN, name); svn_hash_sets(as->authors, author->svn_name, author); } @@ -99,6 +100,7 @@ svn_error_t *author_storage_load(author_storage_t *as, svn_stream_t *src, // Increase lineno counter lineno++; + fprintf(stderr, "%s\n", buf->data); // Parse Subversion username. prev = cstring_skip_whitespace(buf->data); if (*prev == '#' || *prev == '\0') { // Skip comments and empty lines @@ -136,6 +138,7 @@ svn_error_t *author_storage_load(author_storage_t *as, svn_stream_t *src, author->email = apr_pstrndup(as->pool, prev, end - prev + 1); // Save + fprintf(stderr, "%s\n", author->svn_name); svn_hash_sets(as->authors, author->svn_name, author); } diff --git a/bin/CRYPT32.dll b/bin/CRYPT32.dll new file mode 100644 index 0000000000000000000000000000000000000000..c50611bbe7813e69881119e84ac8d3c79aad4dba Binary files /dev/null and b/bin/CRYPT32.dll differ diff --git a/bin/KERNELBASE.dll b/bin/KERNELBASE.dll new file mode 100644 index 0000000000000000000000000000000000000000..59a3e667125d4a2a865887bb84f96f760ee2c319 Binary files /dev/null and b/bin/KERNELBASE.dll differ diff --git a/bin/MSASN1.dll b/bin/MSASN1.dll new file mode 100644 index 0000000000000000000000000000000000000000..3f0683e277d6d09a96d364f8618043f1b6a228a8 Binary files /dev/null and b/bin/MSASN1.dll differ diff --git a/bin/git-svn-fast-import b/bin/git-svn-fast-import new file mode 100644 index 0000000000000000000000000000000000000000..0097056ca0352b2f58d568078d5474ec90b62454 --- /dev/null +++ b/bin/git-svn-fast-import @@ -0,0 +1,111 @@ +#!/bin/sh +# +# Copyright (C) 2014-2015 by Maxim Bublis +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +OPTIONS_SPEC="\ +git-svn-fast-import [options] +-- +h,help show the help +r,revision= set revision range +s,stdlayout set trunk,tags,branches as the relative paths, which is SVN default +incremental incremental mode +b,branch=path set repository as a branch +B,branches=path set repository as a root for branches +t,tag=path set repository as a tag +T,tags=path set repository as a root for tags +I,ignore-path=path ignore a relative repository +i,ignore-abspath!=path ignore repository +no-ignore-abspath=path do not ignore repository +A,authors-file=file load from the mapping of SVN committer names to Git commit authors +export-rev-marks=file dump SVN revision marks to +export-marks=file dump Git marks into +export-branches=file dump known branches into +import-rev-marks=file load SVN revision marks from +import-marks=file load Git marks from +import-marks-if-exists=file load Git marks from , if exists +import-branches=file load branches from +c,checksum-cache=file use as a checksum cache +force force updating modified existing branches, even if doing so would cause commits to be lost +quiet disable all non-fatal output" + +eval "$(echo "$OPTIONS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)" + +SVN_FAST_EXPORT_ARGS= +GIT_FAST_IMPORT_ARGS= + +while [ "$#" -gt 0 ]; do +case $1 in + -s|--incremental) + SVN_FAST_EXPORT_ARGS="$SVN_FAST_EXPORT_ARGS $1" + shift + ;; + -r|-t|-T|-b|-B|-i|-I|-A|--export-rev-marks|--import-rev-marks|--export-branches|--import-branches|--no-ignore-abspath) + SVN_FAST_EXPORT_ARGS="$SVN_FAST_EXPORT_ARGS $1 $2" + shift 2 + ;; + --force|--quiet) + GIT_FAST_IMPORT_ARGS="$GIT_FAST_IMPORT_ARGS $1" + shift + ;; + --export-marks|--import-marks|--import-marks-if-exists) + GIT_FAST_IMPORT_ARGS="$GIT_FAST_IMPORT_ARGS $1=$2" + shift 2 + ;; + --) + shift + ;; + *) + SVN_FAST_EXPORT_ARGS="$SVN_FAST_EXPORT_ARGS $1" + shift + ;; +esac +done + +TMP_PREFIX=/tmp/git-svn-fast-import +TMP_SUFFIX=$$ +CHAN=$TMP_PREFIX.chan.$TMP_SUFFIX + +# Cleanup on EXIT +on_exit() { + rm -f $CHAN +} + +trap 'on_exit' EXIT + +mkfifo $CHAN + +git fast-import $GIT_FAST_IMPORT_ARGS --done <$CHAN & +FAST_IMPORT_PID=$! + +eval "svn-fast-export $SVN_FAST_EXPORT_ARGS" >$CHAN +RET_CODE=$? + +wait $FAST_IMPORT_PID +GIT_RET_CODE=$? + +if test $RET_CODE -gt 0; then + exit $RET_CODE +elif test $GIT_RET_CODE -gt 0; then + exit $GIT_RET_CODE +else + exit 0 +fi diff --git a/bin/msys-2.0.dll b/bin/msys-2.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..b3bb0bd2d8d6c551396e35d7095ff05e75144a1f Binary files /dev/null and b/bin/msys-2.0.dll differ diff --git a/bin/msys-apr-1-0.dll b/bin/msys-apr-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..d2f67001c2706d72345bbf127f47d06b195ff5d8 Binary files /dev/null and b/bin/msys-apr-1-0.dll differ diff --git a/bin/msys-aprutil-1-0.dll b/bin/msys-aprutil-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..fc1e5b0655fea4273b4564d64c9fa132222adeac Binary files /dev/null and b/bin/msys-aprutil-1-0.dll differ diff --git a/bin/msys-bz2-1.dll b/bin/msys-bz2-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..a6ccf6bb25f8302322ffc4db01eb39dc7f65c3e5 Binary files /dev/null and b/bin/msys-bz2-1.dll differ diff --git a/bin/msys-crypt-0.dll b/bin/msys-crypt-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..f05437efe22f993e089cec712a6c6ef2e4a5d5cf Binary files /dev/null and b/bin/msys-crypt-0.dll differ diff --git a/bin/msys-expat-1.dll b/bin/msys-expat-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..cbe50fa9546f21f77ba63183c4b3f30de0a81e2c Binary files /dev/null and b/bin/msys-expat-1.dll differ diff --git a/bin/msys-gcc_s-1.dll b/bin/msys-gcc_s-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..2c111151e58cb2044490df184051940375aece00 Binary files /dev/null and b/bin/msys-gcc_s-1.dll differ diff --git a/bin/msys-iconv-2.dll b/bin/msys-iconv-2.dll new file mode 100644 index 0000000000000000000000000000000000000000..5c8401b795368bbd9ab454a7dbcfee3e4cd73dfa Binary files /dev/null and b/bin/msys-iconv-2.dll differ diff --git a/bin/msys-intl-8.dll b/bin/msys-intl-8.dll new file mode 100644 index 0000000000000000000000000000000000000000..03fae82a8a7b49f32c1d317546705ef910139d8d Binary files /dev/null and b/bin/msys-intl-8.dll differ diff --git a/bin/msys-lz4-1.dll b/bin/msys-lz4-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..2fc1f12ac44196ee389225c33a00789342a3c2c9 Binary files /dev/null and b/bin/msys-lz4-1.dll differ diff --git a/bin/msys-lzma-5.dll b/bin/msys-lzma-5.dll new file mode 100644 index 0000000000000000000000000000000000000000..9e822c95ee3f3688cfe33e5718e0500d73b454e5 Binary files /dev/null and b/bin/msys-lzma-5.dll differ diff --git a/bin/msys-magic-1.dll b/bin/msys-magic-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..9b4739a0c33e5683df3bbc89b8209791bb4c46a2 Binary files /dev/null and b/bin/msys-magic-1.dll differ diff --git a/bin/msys-sqlite3-0.dll b/bin/msys-sqlite3-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..3cd8501a7fba85aaabcdde6301cc901c67103db3 Binary files /dev/null and b/bin/msys-sqlite3-0.dll differ diff --git a/bin/msys-svn_delta-1-0.dll b/bin/msys-svn_delta-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..ad0cc1e36a0a6b0dac6f0a881b1d5e6cc9ad1edf Binary files /dev/null and b/bin/msys-svn_delta-1-0.dll differ diff --git a/bin/msys-svn_fs-1-0.dll b/bin/msys-svn_fs-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..36165ffd9c81ff13fe2cfa1ab933a99379dd2ac2 Binary files /dev/null and b/bin/msys-svn_fs-1-0.dll differ diff --git a/bin/msys-svn_fs_fs-1-0.dll b/bin/msys-svn_fs_fs-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..d404e49c666ab9f0a6848a15b55cb7045929b215 Binary files /dev/null and b/bin/msys-svn_fs_fs-1-0.dll differ diff --git a/bin/msys-svn_fs_util-1-0.dll b/bin/msys-svn_fs_util-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..c9c86ccb9ff72630e7323684945939d6093ecca3 Binary files /dev/null and b/bin/msys-svn_fs_util-1-0.dll differ diff --git a/bin/msys-svn_fs_x-1-0.dll b/bin/msys-svn_fs_x-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..39fa853ec9b2eb8af8075667595ec08f3c45d9bf Binary files /dev/null and b/bin/msys-svn_fs_x-1-0.dll differ diff --git a/bin/msys-svn_repos-1-0.dll b/bin/msys-svn_repos-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..6f35be827d203acab256c827faf24fdc9265110e Binary files /dev/null and b/bin/msys-svn_repos-1-0.dll differ diff --git a/bin/msys-svn_subr-1-0.dll b/bin/msys-svn_subr-1-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..5836b6130b02056035f198e2e62552b2152172dd Binary files /dev/null and b/bin/msys-svn_subr-1-0.dll differ diff --git a/bin/msys-z.dll b/bin/msys-z.dll new file mode 100644 index 0000000000000000000000000000000000000000..46e58b5a9747858eb9565d0168b9292fb979a87c Binary files /dev/null and b/bin/msys-z.dll differ diff --git a/bin/ntdll.dll b/bin/ntdll.dll new file mode 100644 index 0000000000000000000000000000000000000000..4353ef2c403d7ad706a7e5e177d73c4c49b679b8 Binary files /dev/null and b/bin/ntdll.dll differ diff --git a/bin/svn-fast-export.exe b/bin/svn-fast-export.exe new file mode 100644 index 0000000000000000000000000000000000000000..04123c42dbf352b86ea4d811b887a54ec6f2c7e7 Binary files /dev/null and b/bin/svn-fast-export.exe differ diff --git a/bin/svn-ls-tree.exe b/bin/svn-ls-tree.exe new file mode 100644 index 0000000000000000000000000000000000000000..46ffe2f43de294e9ef4fbc8834484576293647fe Binary files /dev/null and b/bin/svn-ls-tree.exe differ diff --git a/bin/ucrtbase.dll b/bin/ucrtbase.dll new file mode 100644 index 0000000000000000000000000000000000000000..6272827fca3fcb8bc5f00351da6e7642d86f986d Binary files /dev/null and b/bin/ucrtbase.dll differ diff --git a/bin/wow64.dll b/bin/wow64.dll new file mode 100644 index 0000000000000000000000000000000000000000..6654371512f4706ea9c5ed8c08a7d59593f725cc Binary files /dev/null and b/bin/wow64.dll differ diff --git a/bin/wow64win.dll b/bin/wow64win.dll new file mode 100644 index 0000000000000000000000000000000000000000..bd34514ed39d57a0add99493ab1abbb5a6e931f3 Binary files /dev/null and b/bin/wow64win.dll differ diff --git a/branch.c b/branch.c index c7f649fc357302a13ae8bdce5365283ad7143ecc..5d00ec8e8d777469eed2f980ec442955d1e6734e 100644 --- a/branch.c +++ b/branch.c @@ -83,6 +83,7 @@ branch_storage_add_branch(branch_storage_t *bs, b->path = apr_pstrdup(bs->pool, path); b->dirty = TRUE; + fprintf(stderr, "add branch %s:%s\n", b->path, b->refname); tree_insert(bs->tree, b->path, b, pool); svn_hash_sets(bs->refnames, b->refname, b); diff --git a/export.c b/export.c index f2ec845092ce103a7b42b3c7631bb3cef5a4565b..ab3be2a5087c643356c774ae344a8545b21780d8 100644 --- a/export.c +++ b/export.c @@ -70,6 +70,8 @@ svn_error_t *get_revision(revision_t **rev, svn_revnum_t revnum, svn_fs_t *fs, r->changes = apr_hash_make(pool); value = svn_hash_gets(revprops, SVN_PROP_REVISION_AUTHOR); + //SVN_ERR("ss11\n"); + if (value != NULL) { r->author = author_storage_lookup(ctx->authors, value->data); } else { @@ -139,6 +141,8 @@ svn_error_t *process_change_record(const char *path, svn_node_kind_t kind = change->node_kind; svn_revnum_t src_rev = change->copyfrom_rev; + //fprintf(stderr, "rev %d find path: %s\n",rev->revnum, path); + ignored = tree_match(ctx->absignores, path, scratch_pool); if (ignored != NULL) { return SVN_NO_ERROR; @@ -430,6 +434,8 @@ svn_error_t *write_revision(svn_stream_t *dst, revision_t *rev, export_ctx_t *ctx, apr_pool_t *pool) { apr_hash_index_t *idx; svn_boolean_t skip; + const char* prefix; + char* tmpstr; skip = (apr_hash_count(rev->commits) == 0 && apr_hash_count(rev->removes) == 0); @@ -449,12 +455,16 @@ svn_error_t *write_revision(svn_stream_t *dst, revision_t *rev, for (idx = apr_hash_first(pool, rev->commits); idx; idx = apr_hash_next(idx)) { branch_t *branch = (branch_t *)apr_hash_this_key(idx); + + //fprintf(stderr, "write commit path:%s refname:%s\n", branch->path, branch->refname); commit_t *commit = apr_hash_this_val(idx); SVN_ERR(write_commit(dst, branch, commit, rev, ctx, pool)); } - SVN_ERR(svn_stream_printf(dst, pool, "progress Imported revision %ld\n", - rev->revnum)); + // SVN_ERR(svn_stream_printf(dst, pool, "progress Imported revision %ld\n", + // rev->revnum)); + + fprintf(stderr, "progress Imported revision %ld\n", rev->revnum); return SVN_NO_ERROR; } @@ -602,13 +612,31 @@ svn_error_t *export_revision_range(svn_stream_t *dst, svn_fs_t *fs, SVN_ERR(prepare_changes(&changes, sorted_changes, rev->root, ctx, rev_pool, scratch_pool)); + int bneed = 0; for (int i = 0; i < changes->nelts; i++) { svn_pool_clear(scratch_pool); sort_item_t item = APR_ARRAY_IDX(changes, i, sort_item_t); + + const char* ppath = (const char*)item.key; + char* tmpstr = strchr(ppath, '/'); + if (tmpstr == NULL) { + tmpstr = item.key; + } else { + tmpstr = apr_pstrndup(pool, ppath, tmpstr - ppath); + } + + //fprintf(stderr, "path=%s pathprefix:%s\n", ppath, tmpstr); + + char* prefix = tree_match(ctx->branches->pfx, tmpstr, pool); + if (prefix == NULL) { + continue; + } + /*ָֻǰ׺IJҪ*/ + bneed = 1; SVN_ERR(process_change_record(item.key, item.value, dst, rev, ctx, rev_pool, scratch_pool)); } - + if(bneed) SVN_ERR(write_revision(dst, rev, ctx, rev_pool)); } diff --git a/svn-fast-export.c b/svn-fast-export.c index af7200e4ea98fde9ded9e51cafd31aaa1c16b451..fb1da251dfd9879e0b4f21d40b1d95ccb948b93b 100644 --- a/svn-fast-export.c +++ b/svn-fast-export.c @@ -168,6 +168,8 @@ svn_error_t *do_main(int *exit_code, int argc, const char **argv, return svn_error_wrap_apr(apr_err, NULL); } + + switch (opt_id) { case 'r': if (start_revision.kind != svn_opt_revision_unspecified) { @@ -193,6 +195,8 @@ svn_error_t *do_main(int *exit_code, int argc, const char **argv, break; case 'B': case 'T': + //svn_cmdline_printf(pool, "%s", opt_arg); + fprintf(stderr, "add prefix %s\n", opt_arg); branch_storage_add_prefix(ctx->branches, opt_arg, FALSE, pool); break; case 'i': @@ -205,7 +209,8 @@ svn_error_t *do_main(int *exit_code, int argc, const char **argv, tree_insert(ctx->no_ignores, opt_arg, opt_arg, pool); break; case 'A': - authors_path = opt_arg; + // authors_path = opt_arg; + authors_path = "user.txt"; break; case option_incremental: incremental = TRUE; @@ -294,8 +299,8 @@ svn_error_t *do_main(int *exit_code, int argc, const char **argv, SVN_ERR(svn_stream_for_stdout(&output, pool)); setup_signal_handlers(); - - err = + + err = export_revision_range(output, fs, lower, upper, ctx, check_cancel, pool); if (export_marks_path != NULL) { diff --git a/symbolize.c b/symbolize.c index 454c5c8c45b0f8dc423689a4685e0542b8e46ca6..a3235b5b966055e95290eedeade56ea55f51faa1 100644 --- a/symbolize.c +++ b/symbolize.c @@ -1,4 +1,4 @@ -#include +//#include #include #include #include @@ -7,14 +7,14 @@ #include /// http://www.unix.com/man-page/freebsd/3/backtrace_symbols_fd/ BSD Compatible void symbolizetrace(int sig) { - void *addresses[1024]; - int n = backtrace(addresses, 1024); - backtrace_symbols_fd(addresses, n, STDERR_FILENO); - signal(sig, SIG_DFL); - raise(sig); +// void *addresses[1024]; +// int n = backtrace(addresses, 1024); +// backtrace_symbols_fd(addresses, n, STDERR_FILENO); +// signal(sig, SIG_DFL); +// raise(sig); } void symbolize() { - signal(SIGSEGV, symbolizetrace); // Invaild memory address - signal(SIGABRT, symbolizetrace); // Abort signal + // signal(SIGSEGV, symbolizetrace); // Invaild memory address + // signal(SIGABRT, symbolizetrace); // Abort signal } diff --git a/uname.mak b/uname.mak index a8470778165f296dec94a32c4ac54e54004794fb..5f6e1918c14d927bbb1f33ae75d4c8a37c1840ec 100644 --- a/uname.mak +++ b/uname.mak @@ -35,8 +35,8 @@ ifeq ($(uname_S),Darwin) endif endif -ifeq ($(uname_S),Linux) +#ifeq ($(uname_S),Linux) ifeq ($(shell test -d /usr/include/subversion-1 && echo y),y) CPPFLAGS +=-I/usr/include/subversion-1 endif -endif +#endif