Fossil

Check-in [5a6b194b]
Login

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

Overview
Comment:Add the -r|--revision option to the annotate command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5a6b194bc900eb001d7574dc086cb8d957c80e3f1286d57b2fb7736ce8de3fd5
User & Date: andygoth 2017-09-23 18:32:24
Context
2017-09-23
18:37
Selectively revert a few changes made by the previous check-in check-in: b83ea94e user: andygoth tags: trunk
18:32
Add the -r|--revision option to the annotate command. check-in: 5a6b194b user: andygoth tags: trunk
2017-09-22
18:10
Show all possible heading styles in Markdown reference. Expand table example to more closely resemble typical usage. check-in: 02403f06 user: andygoth tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/diff.c.

2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485

2486
2487
2488
2489
2490
2491

2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504

2505
2506
2507
2508
2509
2510
2511
2512
2513


2514
2515

2516
2517
2518
2519
2520
2521
2522
....
2528
2529
2530
2531
2532
2533
2534


2535
2536
2537
2538
2539
2540





























2541
2542
2543
2544
2545
2546
2547
2548
2549


2550
2551
2552
2553
2554
2555
2556
2557

2558
2559
2560
2561
2562
2563
2564
}

/*
** COMMAND: annotate
** COMMAND: blame
** COMMAND: praise
**
** Usage: %fossil (annotate|blame|praise) ?OPTIONS? FILENAME
**
** Output the text of a file with markings to show when each line of
** the file was last modified.  The "annotate" command shows line numbers

** and omits the username.  The "blame" and "praise" commands show the user
** who made each check-in and omits the line number.
**
** Options:
**   --filevers                  Show file version numbers rather than
**                               check-in versions

**   -l|--log                    List all versions analyzed
**   -n|--limit N                Only look backwards in time by N versions
**   -w|--ignore-all-space       Ignore white space when comparing lines
**   -Z|--ignore-trailing-space  Ignore whitespace at line end
**
** See also: info, finfo, timeline
*/
void annotate_cmd(void){
  int fnid;         /* Filename ID */
  int fid;          /* File instance ID */
  int mid;          /* Manifest where file was checked in */
  int cid;          /* Checkout ID */
  Blob treename;    /* FILENAME translated to canonical form */

  char *zFilename;  /* Canonical filename */
  Annotator ann;    /* The annotation of the file */
  int i;            /* Loop counter */
  const char *zLimit; /* The value to the -n|--limit option */
  int iLimit;       /* How far back in time to look */
  int showLog;      /* True to show the log */
  int fileVers;     /* Show file version instead of check-in versions */
  u64 annFlags = 0; /* Flags to control annotation properties */
  int bBlame = 0;   /* True for BLAME output.  False for ANNOTATE. */



  bBlame = g.argv[1][0]!='a';

  zLimit = find_option("limit","n",1);
  if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
  iLimit = atoi(zLimit);
  showLog = find_option("log","l",0)!=0;
  if( find_option("ignore-trailing-space","Z",0)!=0 ){
    annFlags = DIFF_IGNORE_EOLWS;
  }
................................................................................

  /* We should be done with options.. */
  verify_all_options();

  if( g.argc<3 ) {
    usage("FILENAME");
  }


  file_tree_name(g.argv[2], &treename, 0, 1);
  zFilename = blob_str(&treename);
  fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
  if( fnid==0 ){
    fossil_fatal("no such file: %s", zFilename);
  }





























  fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
  if( fid==0 ){
    fossil_fatal("not part of current checkout: %s", zFilename);
  }
  cid = db_lget_int("checkout", 0);
  if( cid == 0 ){
    fossil_fatal("Not in a checkout");
  }
  if( iLimit<=0 ) iLimit = 1000000000;


  compute_direct_ancestors(cid);
  mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
          " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
          " ORDER BY ancestor.generation ASC LIMIT 1",
          fid, fnid);
  if( mid==0 ){
    fossil_fatal("unable to find manifest");
  }

  annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
  annotate_file(&ann, fnid, mid, iLimit, annFlags);
  if( showLog ){
    struct AnnVers *p;
    for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
      fossil_print("version %3d: %s %S file %S\n",
                   i+1, p->zDate, p->zMUuid, p->zFUuid);







|

|
|
>
|
|




>











<

>









>
>


>







 







>
>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
<
<
<

<
>
>
|




<
<
|
>







2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504

2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
....
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580



2581

2582
2583
2584
2585
2586
2587
2588


2589
2590
2591
2592
2593
2594
2595
2596
2597
}

/*
** COMMAND: annotate
** COMMAND: blame
** COMMAND: praise
**
** Usage: %fossil annotate|blame|praise ?OPTIONS? FILENAME
**
** Output the text of a file with markings to show when each line of the file
** was last modified.  The version currently checked out is shown by default.
** Other versions may be specified using the -r option.  The "annotate" command
** shows line numbers and omits the username.  The "blame" and "praise" commands
** show the user who made each check-in and omits the line numbers.
**
** Options:
**   --filevers                  Show file version numbers rather than
**                               check-in versions
**   -r|--revision VERSION       The specific check-in containing the file
**   -l|--log                    List all versions analyzed
**   -n|--limit N                Only look backwards in time by N versions
**   -w|--ignore-all-space       Ignore white space when comparing lines
**   -Z|--ignore-trailing-space  Ignore whitespace at line end
**
** See also: info, finfo, timeline
*/
void annotate_cmd(void){
  int fnid;         /* Filename ID */
  int fid;          /* File instance ID */
  int mid;          /* Manifest where file was checked in */

  Blob treename;    /* FILENAME translated to canonical form */
  const char *zRev; /* Revision name, or NULL for current check-in */
  char *zFilename;  /* Canonical filename */
  Annotator ann;    /* The annotation of the file */
  int i;            /* Loop counter */
  const char *zLimit; /* The value to the -n|--limit option */
  int iLimit;       /* How far back in time to look */
  int showLog;      /* True to show the log */
  int fileVers;     /* Show file version instead of check-in versions */
  u64 annFlags = 0; /* Flags to control annotation properties */
  int bBlame = 0;   /* True for BLAME output.  False for ANNOTATE. */
  Manifest *pManifest; /* Manifest structure */
  ManifestFile *pFile; /* Manifest file pointer */

  bBlame = g.argv[1][0]!='a';
  zRev = find_option("r","revision",1);
  zLimit = find_option("limit","n",1);
  if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
  iLimit = atoi(zLimit);
  showLog = find_option("log","l",0)!=0;
  if( find_option("ignore-trailing-space","Z",0)!=0 ){
    annFlags = DIFF_IGNORE_EOLWS;
  }
................................................................................

  /* We should be done with options.. */
  verify_all_options();

  if( g.argc<3 ) {
    usage("FILENAME");
  }

  /* Get filename ID */
  file_tree_name(g.argv[2], &treename, 0, 1);
  zFilename = blob_str(&treename);
  fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
  if( fnid==0 ){
    fossil_fatal("no such file: %s", zFilename);
  }

  /* Get artifact IDs of selected check-in and file */
  if( zRev ){
    /* Get artifact ID of selected check-in manifest */
    mid = name_to_typed_rid(zRev, "ci");

    /* Get manifest structure for selected check-in */
    pManifest = manifest_get(mid, CFTYPE_MANIFEST, 0);
    if( !pManifest ){
      fossil_fatal("could not parse manifest for check-in: %s", zRev);
    }
    
    /* Get selected file in manifest */
    pFile = manifest_file_find(pManifest, zFilename);
    if( !pFile ){
      fossil_fatal("file %s does not exist in check-in %s", zFilename, zRev);
    }
    manifest_destroy(pManifest);

    /* Get file instance ID from manifest file record */
    fid = fast_uuid_to_rid(pFile->zUuid);
  }else{
    /* Get artifact ID of current checkout manifest */
    mid = db_lget_int("checkout", 0);
    if( mid == 0 ){
      fossil_fatal("not in a checkout");
    }

    /* Get file instance ID from current checkout file table */
    fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
    if( fid==0 ){
      fossil_fatal("not part of current checkout: %s", zFilename);
    }



  }


  /* Get ID of most recent manifest containing a change to the selected file */
  compute_direct_ancestors(mid);
  mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
          " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
          " ORDER BY ancestor.generation ASC LIMIT 1",
          fid, fnid);



  if( iLimit<=0 ) iLimit = 1000000000;
  annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
  annotate_file(&ann, fnid, mid, iLimit, annFlags);
  if( showLog ){
    struct AnnVers *p;
    for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
      fossil_print("version %3d: %s %S file %S\n",
                   i+1, p->zDate, p->zMUuid, p->zFUuid);

Changes to www/changes.wiki.

1
2
3
4
5

6
7
8
9
10
11
12
<title>Change Log</title>

<a name='v2_4'></a>
<h2>Changes for Version 2.4 (TBD)</h2>


  *  Support for URL Aliases added.  URL Aliases allow an administrator
     to define their own URLs on the web interface that are rewritten to
     built-in URLs with specific parameters.
  *  Provide separate on-line help screens for each setting.
  *  Back out support for the --no-dir-symlinks option
  *  Remove support from the legacy configuration sync protocol.  The only
     way now to do a configuration push or pull is to use the new protocol that





>







1
2
3
4
5
6
7
8
9
10
11
12
13
<title>Change Log</title>

<a name='v2_4'></a>
<h2>Changes for Version 2.4 (TBD)</h2>

  *  Add the -r|--revision option to the annotate command.
  *  Support for URL Aliases added.  URL Aliases allow an administrator
     to define their own URLs on the web interface that are rewritten to
     built-in URLs with specific parameters.
  *  Provide separate on-line help screens for each setting.
  *  Back out support for the --no-dir-symlinks option
  *  Remove support from the legacy configuration sync protocol.  The only
     way now to do a configuration push or pull is to use the new protocol that