Fossil

Check-in [f77ebeea]
Login

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

Overview
Comment:Add the "fossil git status" command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f77ebeeaec04fd6a5418d5db1fcbd6457ea1fae432ee5f90e8df720217bb333f
User & Date: drh 2019-04-22 13:54:30
Context
2019-04-22
14:22
Enhance the "fossil git export" so that it works for repositories that use a single artifact as both an ordinary file and as a check-in manifest. check-in: fdde65e7 user: drh tags: trunk
13:54
Add the "fossil git status" command. check-in: f77ebeea user: drh tags: trunk
2019-04-19
18:55
Enhance the /timeline query parameter parsing so that the ymd=, ym=, and yw= query parameters can optionally omit the date punctuation. check-in: 9bdda204 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/export.c.

1494
1495
1496
1497
1498
1499
1500































1501
1502
1503
1504
1505
1506
1507
....
1537
1538
1539
1540
1541
1542
1543




1544
1545
1546
1547
1548
1549
1550
....
1552
1553
1554
1555
1556
1557
1558



1559
1560
1561
1562
1563
1564
    gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
    fossil_free(zPushCmd);
    zPushCmd = mprintf("git push --mirror %s", zPushUrl);
    fossil_system(zPushCmd);
    fossil_free(zPushCmd);
  }
}
































/*
** COMMAND: git
**
** Usage: %fossil git SUBCOMMAND
**
** Do incremental import or export operations between Fossil and Git.
................................................................................
**                             Useful for debugging
**         --quiet|-q          Reduce output. Repeat for even less output.
**         --verbose|-v        More output.
**
**   fossil git import MIRROR
**
**       TBD...   




*/
void gitmirror_command(void){
  char *zCmd;
  int nCmd;
  if( g.argc<3 ){
    usage("export ARGS...");
  }
................................................................................
  nCmd = (int)strlen(zCmd);
  if( nCmd>2 && strncmp(zCmd,"export",nCmd)==0 ){
    gitmirror_export_command();
  }else
  if( nCmd>2 && strncmp(zCmd,"import",nCmd)==0 ){
    fossil_fatal("not yet implemented - check back later");
  }else



  {
    fossil_fatal("unknown subcommand \"%s\": should be one of "
                 "\"export\", \"import\"",
                 zCmd);
  }
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>







 







>
>
>


|



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
....
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
....
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
    gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
    fossil_free(zPushCmd);
    zPushCmd = mprintf("git push --mirror %s", zPushUrl);
    fossil_system(zPushCmd);
    fossil_free(zPushCmd);
  }
}

/*
** Implementation of the "fossil git status" command.
**
** Show the status of a "git export".
*/
void gitmirror_status_command(void){
  char *zMirror;
  char *z;
  db_find_and_open_repository(0, 0);
  verify_all_options();
  zMirror = db_get("last-git-export-repo", 0);
  if( zMirror==0 ){
    fossil_print("Git mirror:  none\n");
    return;
  }
  fossil_print("Git mirror:  %s\n", zMirror);
  db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror);
  z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'");
  if( z ){
    fossil_print("Last export: %s\n", z);
  }
  z = db_text(0, "SELECT value FROM mconfig WHERE key='autopush'");
  if( z==0 ){
    fossil_print("Autopush:    off\n");
  }else{
    UrlData url;
    url_parse_local(z, 0, &url);
    fossil_print("Autopush:    %s\n", url.canonical);
  }
}

/*
** COMMAND: git
**
** Usage: %fossil git SUBCOMMAND
**
** Do incremental import or export operations between Fossil and Git.
................................................................................
**                             Useful for debugging
**         --quiet|-q          Reduce output. Repeat for even less output.
**         --verbose|-v        More output.
**
**   fossil git import MIRROR
**
**       TBD...   
**
**   fossil git status
**
**       Show the status of the current Git mirror, if there is one.
*/
void gitmirror_command(void){
  char *zCmd;
  int nCmd;
  if( g.argc<3 ){
    usage("export ARGS...");
  }
................................................................................
  nCmd = (int)strlen(zCmd);
  if( nCmd>2 && strncmp(zCmd,"export",nCmd)==0 ){
    gitmirror_export_command();
  }else
  if( nCmd>2 && strncmp(zCmd,"import",nCmd)==0 ){
    fossil_fatal("not yet implemented - check back later");
  }else
  if( nCmd>2 && strncmp(zCmd,"status",nCmd)==0 ){
    gitmirror_status_command();
  }else
  {
    fossil_fatal("unknown subcommand \"%s\": should be one of "
                 "\"export\", \"import\", \"status\"",
                 zCmd);
  }
}