Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Per forum discussion: when the calculated timestamp of a to-be-touched file is 0, emit a warning and do not set the timestamp. As-yet-uncommitted merges can cause mtime_of_manifest_file() to calculate a time of zero: https://fossil-scm.org/forum/forumpost/6e49ee3725 |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
29f450a5328c25dc3f3011e69314657c |
| User & Date: | stephan 2019-06-14 19:16:07.627 |
Context
|
2019-06-16
| ||
| 17:58 | Adding a simulation (www/collisions.ipynb) for checkin collisions over a working day, given parameters like number of checkins per day. This is in support of discussion on the forum centering on this post: https://fossil-scm.org/forum/forumpost/7349f4b6e1 check-in: 950e54ef35 user: wyoung tags: trunk | |
|
2019-06-14
| ||
| 19:16 | Per forum discussion: when the calculated timestamp of a to-be-touched file is 0, emit a warning and do not set the timestamp. As-yet-uncommitted merges can cause mtime_of_manifest_file() to calculate a time of zero: https://fossil-scm.org/forum/forumpost/6e49ee3725 check-in: 29f450a532 user: stephan tags: trunk | |
| 00:24 | Error message typo fix. check-in: 5b6be64760 user: stephan tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
1801 1802 1803 1804 1805 1806 1807 |
fossil_print("%d\n", file_directory_size(zDir, zGlob, omitDotFiles));
}
/*
** Internal helper for touch_cmd(). zAbsName must be resolvable as-is
** to an existing file - this function does not expand/normalize
** it. i.e. it "really should" be an absolute path. zTreeName is
| | | | | | | | | > > > > > > > > > > | > > > > > > > | | 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 |
fossil_print("%d\n", file_directory_size(zDir, zGlob, omitDotFiles));
}
/*
** Internal helper for touch_cmd(). zAbsName must be resolvable as-is
** to an existing file - this function does not expand/normalize
** it. i.e. it "really should" be an absolute path. zTreeName is
** strictly cosmetic: it is used when dryRunFlag, verboseFlag, or
** quietFlag generate output, and is assumed to be a repo-relative or
** or subdir-relative filename.
**
** newMTime is the file's new timestamp (Unix epoch).
**
** Returns 1 if it sets zAbsName's mtime, 0 if it does not (indicating
** that the file already has that timestamp or a warning was emitted).
** Dies fatally if given an unresolvable filename. If dryRunFlag is
** true then it outputs the name of the file it would have timestamped
** but does not stamp the file. If verboseFlag is true, it outputs a
** message if the file's timestamp is actually modified. If quietFlag
** is true then the output of non-fatal warning messages is
** suppressed.
**
** As a special case, if newMTime is 0 then this function emits a
** warning (unless quietFlag is true), does NOT set the timestamp, and
** returns 0. The timestamp is known to be zero when
** mtime_of_manifest_file() is asked to provide the timestamp for a
** file which is currently undergoing an uncommitted merge (though
** this may depend on exactly where that merge is happening the
** history of the project).
*/
static int touch_cmd_stamp_one_file(char const *zAbsName,
char const *zTreeName,
i64 newMtime, int dryRunFlag,
int verboseFlag, int quietFlag){
i64 currentMtime;
if(newMtime==0){
if( quietFlag==0 ){
fossil_print("SKIPPING timestamp of 0: %s\n", zTreeName);
}
return 0;
}
currentMtime = file_mtime(zAbsName, 0);
if(currentMtime<0){
fossil_fatal("Cannot stat file: %s\n", zAbsName);
}else if(currentMtime==newMtime){
return 0;
}else if( dryRunFlag!=0 ){
fossil_print( "dry-run: %s\n", zTreeName );
}else{
|
| ︙ | ︙ | |||
1890 1891 1892 1893 1894 1895 1896 | ** -g GLOBLIST Comma-separated list of glob patterns. ** -G GLOBFILE Similar to -g but reads its globs from a ** fossil-conventional glob list file. ** -v|-verbose Outputs extra information about its globs ** and each file it touches. ** -n|--dry-run Outputs which files would require touching, ** but does not touch them. | | > > > > > | 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 |
** -g GLOBLIST Comma-separated list of glob patterns.
** -G GLOBFILE Similar to -g but reads its globs from a
** fossil-conventional glob list file.
** -v|-verbose Outputs extra information about its globs
** and each file it touches.
** -n|--dry-run Outputs which files would require touching,
** but does not touch them.
** -q|--quiet Suppress warnings, e.g. when skipping unmanaged
** or out-of-tree files.
**
** Only one of --now, --checkin, and --checkout may be used. The
** default is --now.
**
** Only one of -g or -G may be used. If neither is provided and no
** additional filenames are provided, the effect is as if a glob of
** '*' were provided, i.e. all files belonging to the
** currently-checked-out version. Note that all glob patterns provided
** via these flags are always evaluated as if they are relative to the
** top of the source tree, not the current working (sub)directory.
** Filenames provided without these flags, on the other hand, are
** treated as relative to the current directory.
**
** As a special case, files currently undergoing an uncommitted merge
** might not get timestamped with --checkin because it may be
** impossible for fossil to choose between multiple potential
** timestamps. A non-fatal warning is emitted for such cases.
**
*/
void touch_cmd(){
const char * zGlobList; /* -g List of glob patterns */
const char * zGlobFile; /* -G File of glob patterns */
Glob * pGlob = 0; /* List of glob patterns */
int verboseFlag;
|
| ︙ | ︙ | |||
2022 2023 2024 2025 2026 2027 2028 |
if(pGlob){
if(glob_match(pGlob, zName)==0) continue;
}
blob_appendf( &absBuffer, "%s%s", g.zLocalRoot, zName );
zAbs = blob_str(&absBuffer);
if( newMtime || mtime_of_manifest_file(vid, fid, &newMtime)==0 ){
changeCount +=
| | | | 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 |
if(pGlob){
if(glob_match(pGlob, zName)==0) continue;
}
blob_appendf( &absBuffer, "%s%s", g.zLocalRoot, zName );
zAbs = blob_str(&absBuffer);
if( newMtime || mtime_of_manifest_file(vid, fid, &newMtime)==0 ){
changeCount +=
touch_cmd_stamp_one_file( zAbs, zName, newMtime, dryRunFlag,
verboseFlag, quietFlag );
}
}
db_finalize(&q);
}
glob_free(pGlob);
pGlob = 0;
if(g.argc>2){
|
| ︙ | ︙ | |||
2072 2073 2074 2075 2076 2077 2078 |
if(mtime_of_manifest_file( vid, fid, &newMtime )!=0){
fossil_fatal("Could not resolve --checkin mtime of %s", zTreeFile);
}
}else{
assert(newMtime>0);
}
changeCount +=
| | | | 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 |
if(mtime_of_manifest_file( vid, fid, &newMtime )!=0){
fossil_fatal("Could not resolve --checkin mtime of %s", zTreeFile);
}
}else{
assert(newMtime>0);
}
changeCount +=
touch_cmd_stamp_one_file( zAbs, zArg, newMtime, dryRunFlag,
verboseFlag, quietFlag );
}
}
db_end_transaction(0);
blob_reset(&absBuffer);
if( dryRunFlag!=0 ){
fossil_print("dry-run: would have touched %d file(s)\n",
changeCount);
}else{
fossil_print("Touched %d file(s)\n", changeCount);
}
}
|