2012-03-02 9 views
5

Dopo aver risolto innumerevoli problemi con lo strumento hg-fast-export su Windows (dalla versione minuziosa di Python necessaria per ripulire repository Mercurial per soddisfare lo strumento) ho inciampato su un errore che non riesco a risolvere:Come risolvere l'errore hg-fast-export: "Il nome della filiale non è conforme agli standard GIT: refs/heads/master"

master: Exporting full revision 1/98 with 142/0/0 added/changed/removed files 
fatal: Branch name doesn't conform to GIT standards: refs/heads/master 
fast-import: dumping crash report to .git/fast_import_crash_5956 
Traceback (most recent call last): 
    File "../fast-export/hg-fast-export.py", line 388, in <module> 
    options.statusfile,authors=a,sob=options.sob,force=options.force)) 
    File "../fast-export/hg-fast-export.py", line 322, in hg2git 
    c=export_commit(ui,repo,rev,old_marks,max,c,authors,sob,brmap) 
    File "../fast-export/hg-fast-export.py", line 214, in export_commit 
    export_file_contents(ctx,man,added) 
    File "../fast-export/hg-fast-export.py", line 126, in export_file_contents 
    wr(d) 
    File "../fast-export/hg-fast-export.py", line 28, in wr 
    print msg 
    File "c:\Python26\lib\site-packages\mercurial\windows.py", line 70, in write 
    raise IOError(errno.EPIPE, 'Broken pipe') 
IOError: [Errno 32] Broken pipe 

l'errore sembra essere: nome Branch non è conforme alle norme GIT: refs/teste/master

Qualcuno ha un indizio su come risolvere questo problema?

Il mio repository mercurial è pulito e funziona correttamente, con una sola testina, tutto bello e caldo pronto per essere esportato.

EDIT:

ho risolto il problema utilizzando TortoiseHg combinato con HG-git. Per chiunque cerchi un modo per esportare un rappresentante mercuriale. per git o viceversa, basta seguire i passaggi descritti qui: http://www.ffuts.org/blog/accessing-a-git-repository-with-tortoisehg-on-windows/

+0

qual è l'output di 'hg branches'? – krtek

risposta

8

Ho appena risolto questo problema per me stesso.

Si scopre che Python stava forzando il numero '\r\n' alla fine di ogni riga prodotta da hg-fast-export. Ciò significava che i nomi dei rami venivano interpretati come 'refs/heads/master\r', che non è valido.

La risposta a questa questsion ...

Make Python stop emitting a carriage return when writing newlines to sys.stdout

... può essere posizionato nella parte superiore del file hg-veloce-export, al fine di passare a una modalità binaria.

EDIT:
Il codice per aggiungere è:

if sys.platform == "win32": 
    import os, msvcrt 
    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) 

Basta posizionarlo nella parte superiore del hg-fast-export.py e assicurarsi di avere un import sys in alto.

+0

L'ho provato e non mi ha aiutato. – Adabada

+0

Anche se non ho mai toccato il file hg-export. Segnalo come una risposta, ma consiglio vivamente a chiunque voglia mischiare mercurial e git per andare con la rotta TortoiseHG e hg-git. È più facile, più veloce e ha anche una bella interfaccia utente che puoi usare. – Adabada

+0

Ha funzionato per me. msvcrt.setmode (sys.stdout.fileno(), os.O_BINARY) in alto hg-fast-export.py ha funzionato come un incantesimo. –

Problemi correlati