Svn2git backups tags

Nicolás Alvarez nicolas.alvarez at gmail.com
Sun Apr 9 22:28:05 UTC 2017


2017-04-07 0:36 GMT-03:00 John Lawlor <jk.lawlor at gmail.com>:
> Hi,
>
> I am using svn2git to convert a repository. I only want to match two files
> in the root directory of a folder, and nothing else. I have:
>
> create repository /Labs/ChattyApps
> end repository
>
> match /Labs/ChattyApps/.*.project|.xml?$
>   repository /Labs/ChattyApps
>   branch master
> end match
>
> It complains about the path not being a root directory or something.
>
> By the way - svn2git is a great tool! It's blindingly fast, also nice to be
> able to look at core dumps and pstacks to see what is happening.
>
> John

If I remember correctly, svn2git will take the part of the SVN path
that was *not* matched by the regex and use that as the path in the
new git repository. For example, if you have "match /Labs/ChattyApps/"
and it's applied to "/Labs/ChattyApps/blah.xml", it will remove the
matched substring ("/Labs/ChattyApps/") and create a file called
"blah.xml" in the git repository.

If you're matching files instead of directories, this means you're
matching the *whole* path, and after removing the matched substring,
there is nothing left. svn2git will try to create an empty filename in
git, and git-fast-import will give an error.

The trick to match individual filenames is:

match /Labs/ChattyApps/(.*.project|.xml?)$
  repository /Labs/ChattyApps
  branch master
  prefix \1
end match

This will use the parentheses-captured part of the regex (the
filename) as the prefix, append the substring not matched by the regex
(which is empty because the regex matched everything), and use it as
the git path.

By the way, what filenames are you trying to match? That regex may
need some work... For example, note that ".xml?" means any character
(only one), followed by "xml" or "xm".

-- 
Nicolás


More information about the Kde-scm-interest mailing list