Fossil: Check-in [3a6c848f68]

Fossil SCM

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make --git the default for "fossil import" if neither --git nor --svn is specified. Make --force work (again) with "fossil import --git".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:3a6c848f68e55c2efc1ac5ec251295050d022bd9
User & Date: jan.nijtmans 2015-02-25 16:09:34
Context
2015-02-25
17:19
Usage text only modifications: - Mention about --force. - Show that --git is optional (?--git?) - Add short option (-f for --force and -i for --incremental) (No change to the code) check-in: c2cdd0e3e8 user: mgagnon tags: svn-import
16:09
Make --git the default for "fossil import" if neither --git nor --svn is specified. Make --force work (again) with "fossil import --git". check-in: 3a6c848f68 user: jan.nijtmans tags: svn-import
14:51
Change import command to use --git and --svn options instead of "svn" and "git" sub-sub-command to stay compatible with before. Make sure verify_all_options() fail with specifiying svn only option with --git. check-in: 4d3bb24b44 user: mgagnon tags: svn-import
Changes

Changes to src/import.c.

1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
....
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
....
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
** 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
................................................................................
**
** 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 ){
................................................................................
      }
      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.







|


|
|
|
|







 







|
|






<


<
|




<





<
<

<
>







 







|







1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
....
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
....
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
** 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
................................................................................
**
** 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 ){
................................................................................
      }
      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.