Issue #113 new

Support for empty repositories

Michael Pedersen
created an issue

The following script will not send have the expected results of data appearing in the svn repository.

{{{

!bash

!/bin/bash

BASE=pwd

rm -rf svnroot cosvn cohg >/dev/null 2>&1

echo 'Building svnroot' svnadmin create svnroot URL=file://$BASE/svnroot echo $URL

svn co $URL cosvn cd cosvn svn mkdir trunk tags branches touch trunk/.hidden branches/.hidden

svn add trunk/.hidden branches/.hidden

svn commit -m "Making structure"

echo 'Building hg repos' cd $BASE hg clone $URL cohg cd cohg echo "readme-default" > readme-default.txt hg commit -A -m "adding readme" hg push

echo 'Updating svn' cd $BASE/cosvn svn up }}}

Uncommenting the line "svn add trunk/.hidden" will fix the problem, though.

Comments (13)

  1. Daniel T

    I remember we discussed this awhile ago. I don't quite recall what my solution was, but I think it was something like mapping r0 to null rev. Nor do I recall what the reaction was. I remember the initial reaction was "bad idea" before I fully explained it, but after that, I forget. Anyone see problems with it? It's been a long time since I've looked at code.

  2. Michael Pedersen reporter

    Actually, I might.

    In my case, the actual repository is not totally empty, simply the place where I was cloning from was. And I suspect this would be true of many other svn based projects as well.

    Commonly enough, a repository contains a structure like this:

    repository +proj1 ++branches ++tags ++trunk +proj2 ++branches ++tags ++trunk

    In my particular case, I was initializing a new project in an existing svn repository with a couple thousand revisions in it.

    So, if you're mapping r0 to null rev, I could possibly see issues if you're expecting the root of a new project in an existing svn repository to be there.

    On the other hand, I could be completely wrong, and I apologize if I am.

  3. Daniel T

    I guess my point was that null is not mapped at all, as far as I can tell. Why can't we map it? I recall the problem being something about not having a common parent with the repository.

  4. Augie Fackler repo owner

    I think I could be persuaded to accept some kind of --create-dirs-on-push={single,standard} for single-dir (that is, no trunks/branches/tags) and standard layout (with TBT) flag, where it'd force the target directory to be either empty or not exist, and then create the directory and parents as needed, then start pushing revisions. What do other people think?

  5. edgimar

    How about storing a complete list of of empty directories in a .hgsvnemptydirs file (which is tracked by mercurial, but not synchronized with the remote svn repo), and then any time you "hg up" to a specific revision, there is a post-update hook which generates (ala 'mkdir -p ...') directories in the .hgsvnemptydirs file.

    Additionally, you would need to have a pre-update hook which deletes them (if they are still empty) before updating.

  6. Log in to comment