1

So I have decided to use the svn2git tool after a solid recommendation. In order to migrate the repository, I need authors file and the rules file, along with the repository itself. I composed all these three, and put them under a directory, which I call myRepository_test for the time being. I expect my new git repository to be here after the migration.

Here is the repository structure I currently have:

- myRepository
  -- myRepository.release
  -- myRepository.mapping
  -- myRepository.base
  -- ..

In total I have around 30 projects here.

Hereby I share my files which will be used:

authormap.txt:

egent = Emma Gent <emma.gent@someDomain.com>
gstar = Gabriel Star <gabriel.star@someDomain.com>
.
.

For the time being, I wanted to try only for 2 projects, so:

myRepository.rules:

create repository myRepository
end repository

# main history

match /trunk/myRepository/myRepository.release/
  repository myRepository
  branch master
end match

match /trunk/myRepository/myRepository.mapping/
  repository myRepository
  branch master
end match

# Ignore everything else
match /
end match

which makes the final command:

./svn-all-fast-export --identity-map authormap.txt --rules myRepository.rules --add-metadata http://address/svn/myRepository

which ends as:

Loading rules from: "myRepository.rules" 
Loading rules from "myRepository.rules" 
Could not read the rules file: myRepository.rules
Aborted (core dumped)

I am not very sure about the content of the rules file, would be nice if someone could help me regarding that.

Thanks in advance.

1 Answers1

2

The message you get does not mean the syntax is bogus, the syntax looks fine. It actually cannot find or read the file itself. Do you call svn-all-fast-export from where the directory where your myRepository.rules file is lying. And do you have read rights on the file as the user as which you call svn-all-fast-export?

Regarding the content of the rules file, I don't think it is fully correct already. You store the contents of myRepository.release and myRepository.mapping into the root of your repository. If that was what you intended, it is fine. If not, you should probably use a prefix rule inside the match block so that the contents get added to separate sub-directories. But you will see this after you were able to successfully run the tool anyway.

And one more note, the match expressions are regular expressions, so you might want to escape the . and have match /trunk/myRepository/myRepository\.release/. Or if you really want the contents in the same folder even

match /trunk/myRepository/myRepository\.(release|mapping)/
  repository myRepository
  branch master
end match

or if you want subdirs

match /trunk/myRepository/myRepository\.(release|mapping)/
  repository myRepository
  branch master
  prefix \1
end match

or

match /trunk/myRepository/(myRepository\.(release|mapping))/
  repository myRepository
  branch master
  prefix \1
end match

For more info on rules, see https://techbase.kde.org/Projects/MoveToGit/UsingSvn2Git#How_rulesets_work

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
Vampire
  • 35,631
  • 4
  • 76
  • 102
  • Oh yes, those folders (mapping, release, etc.) are supposed to be seperate sub-directories under the repository, thanks for the catch. So alright, adding `prefix \1`. Point taken regarding the `.` as well, done. Finally, I run the script from the same directory where my rules and author files are. Should I run from `svn2git` folder where the script is originally located (as it is installed there) ? –  May 09 '16 at 14:42
  • 1
    I didn't fully get your last two sentences. But you need to run `svn2git` from where you want your resulting Git repository/-ies being located. For each repository you configured in the rules file you will have a likely named subdirectory with the created Git repository in there. The arguments to `--rules` and `--identity-map` are relative paths to those files from where you execute the program. So if you execute it from the directory where the files are located, you either have a typo in the filename or you do not have read permissions for the file. – Vampire May 09 '16 at 14:47
  • I did so, this time it gave a different error. `Creating new repository "myRepository" svn: Can't open file 'http://address/svn/myRepository/format': No such file or directory Failed to open repository` why does it look for that `/format` anyways? –  May 09 '16 at 14:55
  • You should not use a remote SVN repository address, copy the repository locally and use that local copy. – Vampire May 09 '16 at 15:03
  • Btw. why it looks there is probably because it is part of an SVN repository and there the format version of the repoistory is noted, as repository layout changes over SVN versions. – Vampire May 09 '16 at 15:08
  • I cloned the mapping and release projects into a separate folder and called it `svn-myRepository`. I then referred this directory to the command but still the same error of `/format` –  May 09 '16 at 15:26
  • Please specify "cloned". If you did an svn checkout, that is not the right thing to do. You don't need a checkout, but the repository. Either `rsync` the repository or use something like [rsvndump](http://rsvndump.sourceforge.net/) if you don't have access to the SVN server via SSH. The conversion will run the faster later and you don't need to get the stuff via the remote protocol on each run. – Vampire May 09 '16 at 15:29
  • I did not do checkout, but another command which apparently did not work either. I tried `rsvndump` but it gives error (won't write it here since it is too long), now I am trying to find some documentation on `rsync` –  May 10 '16 at 09:19