2013-08-29 9 views
11

Sto correndo in diversi errori cercando di clonare/speculare un repository GitHub. Ho provato a farlo su HTTPS localmente, o da server a server (quindi posso eseguire l'hotcopy nel repository del server SVN). Lo script BASH sto usando che dovrebbe eseguire il dump del pronti contro termine non riesce con questi errori:Errori nel dumping di un repository SVN remoto basato su Git su HTTP

$ file init svnsync: /// home/jdaniel/www/clone/resto https://github.com/ehime/Restful-MVC-Prototype
svnsync: E125005: Sbagliato o imprevisti valore della proprietà
svnsync: E125003: data di Bogus

$ svnsync sincronizzazione file: /// home/jdaniel/www/clone/resto https://github.com/ehime/Restful-MVC-Prototype
svnsync: E200007: Il rapporto richiesto è sconosciuto.

Ho anche provato ad utilizzare snvrdump ma ottengo un problema simile strano:

$ svnrdump dump https://github.com/ehime/CLI-Parser 

SVN-fs-dump-format-version: 3 

UUID: cfadd8e1-f89a-a5da-a424-ce57b7db7bff 

Revision-number: 0 
Prop-content-length: 163 
Content-length: 163 

K 10 
git-commit 
V 0 

K 10 
svn:author 
V 0 

K 8 
svn:date 
V 0 

K 7 
svn:log 
V 0 

K 25 
svn:wc:ra_dav:version-url 
V 39 
/ehime/Restful-MVC-Prototype/!svn/bln/0 
PROPS-END 

* Dumped revision 0. 
Revision-number: 1 
Prop-content-length: 299 
Content-length: 299 

K 10 
git-commit 
V 40 
ec089b697a5698f71d5edffb2f90b1385acbc53f 
K 10 
svn:author 
V 5 
ehime 
K 8 
svn:date 
V 27 
2013-08-16T17:16:26.000000Z 
K 7 
svn:log 
V 61 
Initial repository configuration with working hello world bs 

K 25 
svn:wc:ra_dav:version-url 
V 39 
/ehime/Restful-MVC-Prototype/!svn/bln/1 
PROPS-END 

svnrdump: E200007: The requested report is unknown. 

Questo finisce con lo stesso errore Requested report is unknown.

Tutti i repository GitHub che ho provato finora (4-5) lanciano quell'errore sconosciuto del report. Per favore aiuto.

+1

La mia scommessa è che i tuoi strumenti falliscono perché github emula solo il sottoinsieme del protocollo di subversion (fondamentalmente webdav) che è richiesto per fare checkout e commit, mentre gli strumenti che stai usando richiedono un vero server di subversion sull'altra estremità. Hai provato a controllare il repository usando git e poi [git-svn] (https://git-scm.com/docs/git-svn) per spingere l'intera storia in sovversione? – Phillip

+0

Chiaramente, il modo migliore per accedere a un repository GitHub è utilizzare Git ;-). Una volta che hai la copia locale, puoi usare qualunque strumento funzioni per permetterti di tornare al repository SVN e non sei limitato dall'emulazione di SVN di GitHub. –

+0

@Phillip Puoi fornire un passo alla volta Git [Hub] a svn repo come risposta? Sembra che questo sia l'unico modo per ottenerlo - e sarebbe quindi la risposta "corretta" che manca qui. –

risposta

3

@SimonSobisch

richiesta per Simons, qui è gli script che ho finito per scrivere a muoversi Subversion in GH

#!/usr/local/env bash 
# Converter for GitHub -> Subversion Repositories 

# CPR : Jd Daniel :: Ehime-ken 
# MOD : 2013-03-09 @ 16:26:53; 2017-01-31 @ 13:36:15 Simon Sobisch 
# VER : Version 1c 

# the Github SVN url to clone from 
URL={THE_SVN_URL} # https://github.com/user/repo/ 

# the SVN url to clone to 
REPO={THE_REPO_ROOT} in # svn+ssh://[email protected]/api/svn_name 

# the SVN structure 
SVNTRUNK=${SVN_TRUNK-trunk} 
SVNTAGS=${SVN_TAGS-tags} 
SVNBRANCHES=${SVN_BRANCHES-branches} 

# use the trunk, branch, etc... I'm using the trunk 
SVN="${REPO}/$SVNTRUNK" 


clear || cls;     # set -x #debug 

## if you want to burn and rebuild your repo, uncomment below 
# 
#echo "Burning Repo..." 
#svn rm $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Burning..." 

#echo "Rebuilding Repo...." 
#svn mkdir $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Rebuilding..." 

# cleanup 
find -maxdepth 1 -type d ! -name '.*' |xargs rm -rf; # tmp 

# dirs 
SVN_FOLDER=`pwd`"/svn" 
GIT_FOLDER=`pwd`"/git" 


# revs 
ENDREV=`svn info $URL |grep Revision: |awk '{print $2}'` 
CURREV=1 

    mkdir -p $SVN_FOLDER $GIT_FOLDER 

echo -e "\nLinking SVN repo\n" 

    cd $SVN_FOLDER 
    svn co $SVN . 

echo -e "\nDownloading GIT repo\n" 

    cd $GIT_FOLDER 
    git svn init -s $URL \ 
    -T $SVNTRUNK \ 
    -t $SVNTAGS \ 
    -b $SVNBRANCHES \ 
    --prefix=svn/ 

    # Set authors so we get prettier authors 
    if [ -f "../authors"]; then 
    git config svn.authorsfile ../authors 
    fi 

    echo -e "\nFound ${ENDREV} revisions\n" 

    for ((REVISION=$CURREV; REVISION<$ENDREV+1; REVISION++)) 
    do 

    cd $GIT_FOLDER 

    echo -e "\n---> FETCHING: ${REVISION}\n" 

    git svn fetch -r$REVISION;    echo -e "\n" 
    git rebase `git svn find-rev r$REVISION`; echo -e "\n" 

    # STATUS: git log -p -1 `git svn find-rev r19` --pretty=format: --name-only --diff-filter=A | sort -u 
    ADD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=A |awk '{printf "%s ", $1}') 
    MOD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=M |awk '{printf "%s ", $1}') 
    DEL=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=D |awk '{printf "%s ", $1}') 

     # copy new files 
     for i in $ADD 
     do 
     cp --parents $i $SVN_FOLDER/ 
     done 


     # copy modified files 
     for i in $MOD 
     do 
     cp --parents $i $SVN_FOLDER/ 
     done 


    # set opts for SVN logging 
    HASH=$(git log -1 --pretty=format:'Hash: %h <%H>') 
    AUTHOR='Jd Daniel <[email protected]>' # or $(git log -1 --pretty="%cn <%cE>") 

    TMPDATE=$(git log -1 --pretty=%ad --date=iso8601) 
    DATE=$(date --date "$TMPDATE" -u +"%Y-%m-%dT%H:%M:%S.%N" |sed 's/.....$/Z/g') 

    LOGMSG=$(git log -1 --pretty=%s) 

    # move to svn 
    cd $SVN_FOLDER 


    # burn file if it exists.... 
    if [ "$DEL" != "" ]; then 
     for i in $DEL 
     do 
     test -f $i && svn --force rm $i 
     done 
    fi 

    # first round of additions.... 
    [ -z "$ADD" ] || svn --force add $ADD 
    [ -z "$MOD" ] || svn --force add $MOD 


    # try 2 for adding in case we missed ? files 
    ADDTRY=$(svn st . |grep "^?" |awk '{print $2}') 
    [ -z "$ADDTRY" ] || svn --force add $ADDTRY 

    # do commit 
    svn ci -m "$LOGMSG"$'\n\n'"$HASH" 

    # servers pre-revprop-change 
    # cp hooks/pre-revprop-change.tmpl pre-revprop-change; chmod +x pre-revprop-change 
    # if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:author" ]; then exit 0; fi 
    # if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi 
    # echo "Changing revision properties other than svn:log, svn:author and svn:date is prohibited" >&2 

    # change this commits author and date 
    svn propset --revprop -r HEAD svn:author "$AUTHOR" 
    svn propset --revprop -r HEAD svn:date "$DATE" 

    done 

exit 

In ogni caso, git-svn supporta questa davvero bene, con solo una leggera variazione sul solito git svn clone.

Invece dei tag standard di progetto/trunk | branches | usiamo un numero leggermente diverso parent/trunk|branches|tags/project quindi vedrete che specificherò i flag - T/-t/-b.

git svn init 

Ecco quello che faccio, dal repo git locale esistente:

# Create the project directory in subversion 
$ /usr/bin/svn mkdir 
    https://foo.com/svn/parent/trunk/project 
    -m "Make project directory." 
Committed revision 200. 

# Initialize git-svn, doesn't fetch anything yet 
$ git svn init https://foo.com/svn/ 
    -T parent/trunk/project 
    -t parent/tags/project 
    -b parent/branches/project 
    --prefix=svn/ 

# Set authors so we get prettier authors 
$ git config svn.authorsfile ../authors 

# Now pull down the svn commits 
$ git svn fetch 
W: Ignoring error from SVN, ... 
W: Do not be alarmed at the above message git-svn ... 
This may take a while on large repositories 
r200 = (guid) (refs/remotes/svn/trunk) 

# We should now see our svn trunk setup under our svn remote 
$ git branch -av 
* master   c3a7161 The latest git commit. 
    remotes/svn/trunk 3b7fed6 Make project directory. 

# Now we want to take all of our local commits and 
# rebase them on top of the new svn/trunk 
$ git rebase svn/trunk 
First, rewinding head to replay your work on top of it... 
Applying: First git commit 
Applying: The latest git commit 

# Now we should see our local commits applied 
# on top of svn/trunk 
$ git lg 
* 52b7977 (HEAD, master) The latest git commit 
* a34e162 First git commit 
* 3b7fed6 (svn/trunk) Make project directory. 

# Everything is cool, push it back to svn 
$ git svn dcommit 
Committing to https://foo.com/svn/parent/trunk/project 
... 

–prefix=svn 

Una bandiera mi piace soprattutto ultimamente, che si può anche utilizzare con git svn clone, è --prefix=svn/.

Questo prefisso tutti i rami di tracciamento dei rami, tag e trunk di Subversion remoti con svn /, facendo sembrare tutto come la solita origine/idioma utilizzata dai normali telecomandi git.

con i rami di tracciamento con un prefisso, è possibile utilizzarli anche come nomi di filiali locali, come ad esempio:

# Name your copy of svn/trunk "trunk" instead of "master" 
$ git checkout -b trunk master 
Switched to a new branch 'trunk' 

$ git branch -d master 
Deleted branch master (was 33c3136). 

$ git branch -av 
* trunk    33c3136 Latest svn commit 
* remotes/svn/trunk 33c3136 Latest svn commit 

Poi, se si dispone di altri rami si desidera tenere traccia:

$ git checkout -b featurea svn/featurea 
+0

@SimonSobisch ecco la risposta che volevi – ehime

+0

E se questo non funziona ho altri tre modi, solo ping me;) – ehime

+0

Il primo script attualmente viene eseguito quindi non posso dire il risultato finale - solo alcuni possibili problemi che voglio menzionarlo per questo: 1. impiega molto tempo se lo usi, anche se il repository svn è locale (ne ho creato uno nuovo localmente, accedendo tramite il protocollo 'file:') 2. controlla per git e svn binary (il mio nuovo PC di test non ha git installato) e per svn revprop hook - lo script al momento non verifica questo. 3. Probabilmente non funziona come dovrebbe - almeno ottengo un sacco di "cp: non posso stat" some-file': No such file o directory "warnings quando si esegue (il primo) script –

Problemi correlati