Fossil

Check-in [52dd8a91bf]
Login

Check-in [52dd8a91bf]

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

Overview
Comment:Improvements to the help text and code comments for the "describe" command.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 52dd8a91bf2e689010ce8c0bfc2ae0e27d13abea814589d0f82c8d209dc6ad60
User & Date: danield 2022-03-31 09:14:01.693
Context
2022-03-31
09:37
Added "fossil describe" to the change log. ... (check-in: 56ef05a567 user: danield tags: trunk)
09:14
Improvements to the help text and code comments for the "describe" command. ... (check-in: 52dd8a91bf user: danield tags: trunk)
08:21
In "fossil describe", use hash_digits() as the default length when printing the commit hash. ... (check-in: 951cf9faf3 user: danield tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/info.c.
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
      db_column_text(&q,3));
  }
  db_finalize(&q);
}

#if INTERFACE
/* 
** Description of a checkin relative to an earlier, tagged checkin.
*/
typedef struct CommitDescr {
  char *zRelTagname;        /* Tag name on the relative checkin */
  int nCommitsSince;        /* Number of commits since then */
  char *zCommitHash;        /* Hash of the described checkin */
  int isDirty;              /* Working directory has uncommitted changes */
} CommitDescr;
#endif

/*
** Describe the checkin given by 'zName', and possibly matching 'matchGlob',
** relative to an earlier, tagged checkin. Use 'descr' for the output.
**
** Finds the closest ancestor (ignoring merge-ins) that has a non-propagating
** label tag and the number of steps backwards that we had to search in
** order to find that tag.
**
** Return values:
**       0: ok
**      -1: zName does not resolve to a commit
**      -2: zName resolves to more than a commit
**      -3: no ancestor commit with a fitting non-propagating tag found
*/







|


|

|





|
|



|







3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
      db_column_text(&q,3));
  }
  db_finalize(&q);
}

#if INTERFACE
/* 
** Description of a check-in relative to an earlier, tagged check-in.
*/
typedef struct CommitDescr {
  char *zRelTagname;        /* Tag name on the relative check-in */
  int nCommitsSince;        /* Number of commits since then */
  char *zCommitHash;        /* Hash of the described check-in */
  int isDirty;              /* Working directory has uncommitted changes */
} CommitDescr;
#endif

/*
** Describe the check-in given by 'zName', and possibly matching 'matchGlob',
** relative to an earlier, tagged check-in. Use 'descr' for the output.
**
** Finds the closest ancestor (ignoring merge-ins) that has a non-propagating
** label tag and the number of steps backwards that we had to search in
** order to find that tag.  Tags applied to more than one check-in are ignored.
**
** Return values:
**       0: ok
**      -1: zName does not resolve to a commit
**      -2: zName resolves to more than a commit
**      -3: no ancestor commit with a fitting non-propagating tag found
*/
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804



3805
3806
3807
3808
3809

3810
3811
3812
3813
3814
3815
3816
/*
** COMMAND: describe
**
** Usage: %fossil describe ?VERSION? ?OPTIONS?
**
** Provide a description of the given VERSION by showing a non-propagating
** tag of the youngest tagged ancestor, followed by the number of commits
** since that, and the short hash of VERSION.  If VERSION and the found 
** ancestor refer to the same commit, the last two components are omitted,
** unless --long is provided.
**
** If no VERSION is provided, describe the current checked-out version.  When



** no fitting tagged ancestor is found, show only the short hash of VERSION.
**
** Options:
**
**    --digits           Display so many hex digits of the hash (default 10)

**    -d|--dirty         Show whether there are changes to be committed
**    --long             Always show all three components
**    --match GLOB       Consider only non-propagating tags matching GLOB
*/
void describe_cmd(void){
  const char *zName;
  const char *zMatchGlob;







|
<
|

|
>
>
>
|



|
>







3793
3794
3795
3796
3797
3798
3799
3800

3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
/*
** COMMAND: describe
**
** Usage: %fossil describe ?VERSION? ?OPTIONS?
**
** Provide a description of the given VERSION by showing a non-propagating
** tag of the youngest tagged ancestor, followed by the number of commits
** since that, and the short hash of VERSION.  Only tags applied to a single

** check-in are considered.
**
** If no VERSION is provided, describe the current checked-out version.
**
** If VERSION and the found ancestor refer to the same commit, the last two
** components are omitted, unless --long is provided.  When no fitting tagged
** ancestor is found, show only the short hash of VERSION.
**
** Options:
**
**    --digits           Display so many hex digits of the hash 
**                       (default: the larger of 6 and the 'hash-digit' setting)
**    -d|--dirty         Show whether there are changes to be committed
**    --long             Always show all three components
**    --match GLOB       Consider only non-propagating tags matching GLOB
*/
void describe_cmd(void){
  const char *zName;
  const char *zMatchGlob;