829
830
831
832
833
834
835
836
837
838
839
840
841
842
|
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
*/
void test_topological_sort(void){
int n;
db_find_and_open_repository(0, 0);
n = topological_sort_checkins(1);
fossil_print("%d reorderings required\n", n);
}
/***************************************************************************
** Implementation of the "fossil mirror" command follows. We hope that the
** new code that follows will largely replace the legacy "fossil export" code
** above.
*/
/*
** Convert characters of z[] that are not allowed to be in branch or
** tag names into "_".
*/
static void mirror_sanitize_git_name(char *z){
static unsigned char aSafe[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 2x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* 3x */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, /* 5x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, /* 7x */
};
unsigned char *zu = (unsigned char*)z;
int i;
for(i=0; zu[i]; i++){
if( zu[i]>0x7f || !aSafe[zu[i]] ){
zu[i] = '_';
}else if( zu[i]=='/' && (i==0 || zu[i+1]==0 || zu[i+1]=='/') ){
zu[i] = '_';
}else if( zu[i]=='.' && (zu[i+1]==0 || zu[i+1]=='.'
|| (i>0 && zu[i-1]=='.')) ){
zu[i] = '_';
}
}
}
/*
** Transfer a tag over to the mirror. "rid" is the BLOB.RID value for
** the record that describes the tag.
**
** The Git tag mechanism is very limited compared to Fossil. Many Fossil
** tags cannot be exported to Git. If this tag cannot be exported, then
|