[fossil-users] svn to fossil migration script

2011-03-28 Thread mightyhe
I followed someone's advice to pipe svn-fe's output into fossil's git
importer, and the result is just awful.  I blame svn-fe for not handling
the standard svn repository layout properly.  What I have are svn dump
files, and lots of them.  The steps I've found that will import all
branches and tags properly require git-svn, and are as follows:

# If you have a dump file...
svnadmin create svn_myrepos
svnadmin load svn_myrepos  myrepos.dmp

# Now that you have a repository directory...
mkdir git_myrepos
cd git_myrepos
git svn init -s file:///home/myuser/svn_myrepos
git svn fetch

# at this point, it's the standard import
git fast-export --all | fossil import --git myrepos.fossil

I've attached a script to do this in batch, along with setting a standard
password on all of the imported repositories (I needed it).

mightyhe#!/usr/bin/python
import os
import re
import getpass

def main():
***Warning*** - This script works on Unix only
   ***Warning*** - This script requires git-svn to work, try yum install svn-git

   For those of us who read the subversion manual, and did a standard layout, we
   find that svn-fe path_to_repository | fossil import --git repos.fossil just
   isn't good enough, because svn-fe doesn't properly handle branches and tags.
   To handle things properly, we need to use git-svn -s somewhwere along the
   data transfer path.

   This script will take a directory of subversion dmp files with standard layout
   (trunk, root, tags) and turn them into fossil repositories if you don't have a
   dmp file, you can either svnadmin dump /path_to_repos  repos.dmp or alter
   the script to use repository paths directly (jump to git svn init)

cwd = os.getcwd()
defuser = getpass.getuser()
defpasswd = getpass.getpass('Default Fossil Password: ')

for fname in os.listdir('.'):
mo = re.match(r'(.+)\.dmp', fname)
if not mo:
continue
print processing +os.path.join(cwd,fname)+...
base = mo.group(1)
dmpfile = os.path.join(cwd, fname)
svndir = os.path.join(cwd,'svn_'+base)
gitdir = os.path.join(cwd,'git_'+base)
fossilfile = os.path.join(cwd,base+'.fossil')
os.system('svnadmin create '+svndir)
os.system('svnadmin load '+svndir+'  '+dmpfile)
os.mkdir(gitdir)
os.chdir(gitdir)
os.system('git svn init -s file://'+svndir)
os.system('git svn fetch')
os.system('git fast-export --all | fossil import --git '+fossilfile)
os.chdir(cwd)
os.system('rm -Rf '+gitdir)
os.system('rm -Rf '+svndir)
os.system('fossil user --repository '+fossilfile+' password '+defuser+' '+defpasswd)

main()___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] http(s) basic authentication

2011-03-27 Thread mightyhe
There's probably a more official channel for this, but I've never been
much for paperwork, so here goes.  Here's a patch to do basic
authorization with my public domain blessing (in case there is any doubt),
and my story in case it helps you troubleshoot your own 401 problem.

So I set up fossil behind Apache, HTTPS+basic authorization. Had to fuss a
bit with the Makefile for the client, but otherwise everything is going
well until I try to do a...

fossil clone https://myuser:mypass@mysite/fossil/myproj myprojfossil

and I get back 401 Authorization Required.  I check the Apache
logs on the server (/var/log/httpd/ssl_access_log), and it says I didn't
authenticate the POST, which loooks like this (obviously not my real IP
address):

1.2.3.4 - - [26/Mar/2011:19:27:54] POST
https://mysite/fossil/myproj/xfer/xfer HTTP/1.0 401 486

Clearly not sending the password.  If you're troubleshooting your own
problems along these lines, and you missed that, the - - part should
read - myuser -, when the authorization is sent, and the 401 we got is
the next to last field, which will be 200 when all is clear.  Easy enough
with a search for xfer/xfer, and yes the Authorization: Basic header
is nowhere in sight, so I add it rebuild and run it, here is what the
success log looks like when the authorization
is present.

1.2.3.4 - myuser - [26/Mar/2011:19:47:54] POST
https://mysite/fossil/myproj/xfer/xfer HTTP/1.0 200 486

On an unrelated note, I originally included the Makefile.mingw patch too,
it's only about 6 lines or so, but for some reason diff had a hard time
picking out my 6 lines from the rest, and produced a diff that subtracted
the entire old version of the contents and then added the entire version
of the new contents.  The result was a 100k patch, and the mail got
flagged as too big.  If anyone needs that patch it's theirs for the
asking.

mightyhe




http.c.diff
Description: Binary data
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] http(s) basic authentication - patch 2

2011-03-27 Thread mightyhe
Fixed my patch problems, it seems I have to set my windows editor to use
LF alone, or else bad things happen.  You'll probably be getting a patch
about that too ;)

In the meantime, here's a patch with both the Makefile and http updates.

--- original message follows ---

There's probably a more official channel for this, but I've never been
much for paperwork, so here goes.  Here's a patch to do basic
authorization with my public domain blessing (in case there is any doubt),
and my story in case it helps you troubleshoot your own 401 problem.

So I set up fossil behind Apache, HTTPS+basic authorization. Had to fuss a
bit with the Makefile for the client, but otherwise everything is going
well until I try to do a...

fossil clone https://myuser:mypass@mysite/fossil/myproj myprojfossil

and I get back 401 Authorization Required.  I check the Apache
logs on the server (/var/log/httpd/ssl_access_log), and it says I didn't
authenticate the POST, which loooks like this (obviously not my real IP
address):

1.2.3.4 - - [26/Mar/2011:19:27:54] POST
https://mysite/fossil/myproj/xfer/xfer HTTP/1.0 401 486

Clearly not sending the password.  If you're troubleshooting your own
problems along these lines, and you missed that, the - - part should
read - myuser -, when the authorization is sent, and the 401 we got is
the next to last field, which will be 200 when all is clear.  Easy enough
with a search for xfer/xfer, and yes the Authorization: Basic header
is nowhere in sight, so I add it rebuild and run it, here is what the
success log looks like when the authorization
is present.

1.2.3.4 - myuser - [26/Mar/2011:19:47:54] POST
https://mysite/fossil/myproj/xfer/xfer HTTP/1.0 200 486

On an unrelated note, I originally included the Makefile.mingw patch too,
it's only about 6 lines or so, but for some reason diff had a hard time
picking out my 6 lines from the rest, and produced a diff that subtracted
the entire old version of the contents and then added the entire version
of the new contents.  The result was a 100k patch, and the mail got
flagged as too big.  If anyone needs that patch it's theirs for the
asking.

mightyhe




https.diff
Description: Binary data
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users