1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
|
** Read interchange format generated by another VCS and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY
** argument. If no input file is supplied the interchange format
** data is read from standard input.
**
** The following formats are currently understood by this command
**
** --git Import from the git-fast-export file format
**
** --svn Import from the svnadmin-dump file format. The default
** behaviour (unless overridden by --flat) is to treat 3 folders
** in the SVN root as special, following the common layout of
** SVN repositories. These are (by default) trunk/, branches/
** and tags/
** Options:
** --trunk FOLDER Name of trunk folder
** --branches FOLDER Name of branches folder
** --tags FOLDER Name of tags folder
** --base PATH Path to project root in repository
** --flat The whole dump is a single branch
** --no-svn-rev Omit 'snv-rev-nnn' tags on checkins
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
** Options:
** --incremental allow importing into an existing repository
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int gitFlag=0;
int svnFlag=0;
/* Options common to all input formats */
int incrFlag = find_option("incremental", "i", 0)!=0;
/* Options for --svn only */
const char *zBase="";
int forceFlag=0;
int flatFlag=0;
if( find_option("svn", 0, 0) ){
svnFlag=1;
/* Get --svn related options here, so verify_all_options() fail when svn
* only option are specify with --git
*/
zBase = find_option("base", 0, 1);
forceFlag = find_option("force", "f", 0)!=0;
flatFlag = find_option("flat", 0, 0)!=0;
gsvn.zTrunk = find_option("trunk", 0, 1);
gsvn.zBranches = find_option("branches", 0, 1);
gsvn.zTags = find_option("tags", 0, 1);
gsvn.noSvnRevFlag = find_option("no-svn-rev", 0, 0)!=0;
}else if( find_option("git", 0, 0) ){
gitFlag=1;
}else{
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
|
|
|
|
|
|
|
|
<
<
|
<
<
<
<
>
|
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
|
** Read interchange format generated by another VCS and use it to
** construct a new Fossil repository named by the NEW-REPOSITORY
** argument. If no input file is supplied the interchange format
** data is read from standard input.
**
** The following formats are currently understood by this command
**
** --git Import from the git-fast-export file format (default)
**
** --svn Import from the svnadmin-dump file format. The default
** behaviour (unless overridden by --flat) is to treat 3
** folders in the SVN root as special, following the
** common layout of SVN repositories. These are (by
** default) trunk/, branches/ and tags/
** Options:
** --trunk FOLDER Name of trunk folder
** --branches FOLDER Name of branches folder
** --tags FOLDER Name of tags folder
** --base PATH Path to project root in repository
** --flat The whole dump is a single branch
** --no-svn-rev Omit 'snv-rev-nnn' tags on checkins
**
** The --incremental option allows an existing repository to be extended
** with new content.
**
** Options:
** --incremental allow importing into an existing repository
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
int svnFlag = find_option("svn", 0, 0)!=0;
/* Options common to all input formats */
int incrFlag = find_option("incremental", "i", 0)!=0;
/* Options for --svn only */
const char *zBase="";
int flatFlag=0;
if( svnFlag ){
/* Get --svn related options here, so verify_all_options() fail when svn
* only option are specify with --git
*/
zBase = find_option("base", 0, 1);
flatFlag = find_option("flat", 0, 0)!=0;
gsvn.zTrunk = find_option("trunk", 0, 1);
gsvn.zBranches = find_option("branches", 0, 1);
gsvn.zTags = find_option("tags", 0, 1);
gsvn.noSvnRevFlag = find_option("no-svn-rev", 0, 0)!=0;
}else{
find_option("git",0,0); /* Skip the --git option for now */
}
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
|
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
|
}
if( gsvn.zTags[gsvn.lenTags-1]!='/' ){
gsvn.zTags = mprintf("%s/", gsvn.zTags);
gsvn.lenTags++;
}
}
svn_dump_import(pIn);
}else if( gitFlag ){
/* The following temp-tables are used to hold information needed for
** the import.
**
** The XMARK table provides a mapping from fast-import "marks" and symbols
** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
** Given any valid fast-import symbol, the corresponding fossil rid and
** uuid can found by searching against the xmark.tname field.
|
|
|
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
|
}
if( gsvn.zTags[gsvn.lenTags-1]!='/' ){
gsvn.zTags = mprintf("%s/", gsvn.zTags);
gsvn.lenTags++;
}
}
svn_dump_import(pIn);
}else{
/* The following temp-tables are used to hold information needed for
** the import.
**
** The XMARK table provides a mapping from fast-import "marks" and symbols
** into artifact ids (UUIDs - the 40-byte hex SHA1 hash of artifacts).
** Given any valid fast-import symbol, the corresponding fossil rid and
** uuid can found by searching against the xmark.tname field.
|