HG Convert on SVN gives “does not look like a Subv

2020-07-16 02:50发布

I just installed TortoiseHG v2.11 with Mercurial-2.9

I am attempting to convert my local Subversion repositories created with TortoiseSVN 1.8. 4, Subversion 1.8.5

To be sure that my old Subversion repositories don't have any weird quirks I created a new SVN repo called test_repo with the default folder structure, performed a Checkout to test_repowc, then added some text files to the trunk, then modified and committed the files a few times to provide some history.

I then opened cmd.exe, navigated to the folder and tried

hg convert test_repo

and got the following:

assuming destination test_repo-hg
initializing destination test_repo-hg repository
test_repo does not look like a CVS checkout
test_repo does not look like a Git repository
file:///C:/Users/xxxxxx/Documents/Subversion/test_repo does not look like a Subversion repository
test_repo is not a local Mercurial repository
test_repo does not look like a darcs repository
test_repo does not look like a monotone repository
test_repo does not look like a GNU Arch repository
test_repo does not look like a Bazaar repository
cannot find required "p4" tool
abort: test_repo: missing or unsupported repository

As you can see, Mercurial did the file:/// protocol for me, but was unable to recognize the subversion repository. I've tried doing the file:/// protocol myself, specifying the repository type with the -s flag, running Mongoose in the folder and accessing the repository as a URL, and none of it seems to work. I've also tried converting from the working copy instead of from the repository, but that doesn't work either.

I'm wondering if it has to do with the new SVN file structure that SVN 1.7 or 1.8 introduced (which some SVN clients were incompatible with for a while)?

Has anyone else had luck with this using current versions of TortoiseSVN and TortoiseHG?

I was intending on this being a super quick thing to transition, getting all excited about DVCS and Mercurial, and I've already hit a wall. I read lots of people saying it was dead simple, but either I've got a bizarre edge case or it's not as easy as the rumors sound.

I've read about other tools like HGSubversion where I could clone my SVN as an HG repo, but since these are solo repositories I'd rather just convert the SVN, make sure everything works, then delete and uninstall SVN. I'd rather my HG repository not still be "connected" to the SVN (HGSubversion allows "push" from the cloned HG repo to the parent SVN repo right?). Other tools have mixed reviews so I was hoping to get the convert extension working.

Thanks in advance - looking forward to Mercurial!

EDIT:

Documenting a solution for Windows:

  1. Open a Command Prompt
  2. Navigate to your SVN repository (not a working copy)
  3. run svnserve -r .\ -d
  4. Open another Command Prompt
  5. Navigate to where you want your mercurial repo
  6. Optional: Run where hg ... if TortoiseHg version isn't first, edit the path to make it first - this version includes the SVN python bindings which are necessary to use svn:// protocol. Restart your cmd prompt after editing the path.
  7. run hg convert -s svn svn://localhost .\hg_repo_name

    • I did my computername.full.domain.name instead of localhost, but localhost should work too.
    • svn:// slash direction is like http:// and file:/// not like C:\
    • If your SVN repo code doesn't have a trunk or you didn't use the trunk folder (I didn't for my first repos because I didn't know what I was doing), you need this, which tells mercurial to use the root directory as the trunk:

    hg --config config.svn.trunk= convert -s svn svn:\\localhost .\hg_repo_name

    • I just had an SVN repo where I imported a folder of code into the root, but not into the trunk... I tried using the code above to set the trunk equal to the code folder name but it wouldn't work... however, when I appended the folder name to the svn url it worked:

    `hg convert svn://%computername%.domain.com/code_folder .\hg_repo_name

Good luck!

1条回答
我想做一个坏孩纸
2楼-- · 2020-07-16 03:43

As the Convert wiki states

Prerequisites:

Subversion's Python bindings

and it seems Python bindings are not updated yet (at least) for using ra_local with 1.8+ repositories.

You have two choices

  • Create 1.7-compatible local SVN-repositories for later converting

OldRepo>svnadmin create --compatible-version "1.7" .

>svn log file:///Z:/OldRepo
------------------------------------------------------------------------
r1 | Badger | 2014-02-15 00:30:22 +0600 (Сб, 15 фев 2014) | 1 line

Create initial state
------------------------------------------------------------------------
>hg convert file:///Z:/OldRepo HG2-Repo
initializing destination HG2-Repo repository
scanning source...
sorting...
converting...
1 Create initial state
0 Create initial state

The same result after cloning OldRepo using HGSubversion

>hg clone file:///Z:/OldRepo HG-Repo
[r1] Badger: Create initial state
pulled 2 revisions
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  • Use any server for accessing 1.8+ repository (svnserve is the easiest way). I haven't tried svn:// repository, but tested remote http-served repository of 1.8 Subversion

Just sample

hg clone https://subversion.assembla.com/....
...
25 files updated, 0 files merged, 0 files removed, 0 files unresolved
查看更多
登录 后发表回答