Fossil SCM

Add EXECUTABLE, SYMLINK, UNEXEC, UNLINK reports to [fossil changes] and [fossil status] when a file becomes or ceases to be executable or a symlink yet is otherwise unmodified. This change does not apply to Windows. Update the changelog accordingly. Update vfile_check_signature() comment to also describe "integrate" changes.

andygoth 2015-05-15 05:00 UTC trunk
Commit 03679b582742c8494653c6e7efdc2427d368cb63
--- src/checkin.c
+++ src/checkin.c
@@ -113,10 +113,18 @@
113113
blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
114114
}else if( isChnged==4 ){
115115
blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName);
116116
}else if( isChnged==5 ){
117117
blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName);
118
+ }else if( isChnged==6 ){
119
+ blob_appendf(report, "EXECUTABLE %s\n", zDisplayName);
120
+ }else if( isChnged==7 ){
121
+ blob_appendf(report, "SYMLINK %s\n", zDisplayName);
122
+ }else if( isChnged==8 ){
123
+ blob_appendf(report, "UNEXEC %s\n", zDisplayName);
124
+ }else if( isChnged==9 ){
125
+ blob_appendf(report, "UNLINK %s\n", zDisplayName);
118126
}else if( file_contains_merge_marker(zFullName) ){
119127
blob_appendf(report, "CONFLICT %s\n", zDisplayName);
120128
}else{
121129
blob_appendf(report, "EDITED %s\n", zDisplayName);
122130
}
123131
--- src/checkin.c
+++ src/checkin.c
@@ -113,10 +113,18 @@
113 blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
114 }else if( isChnged==4 ){
115 blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName);
116 }else if( isChnged==5 ){
117 blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName);
 
 
 
 
 
 
 
 
118 }else if( file_contains_merge_marker(zFullName) ){
119 blob_appendf(report, "CONFLICT %s\n", zDisplayName);
120 }else{
121 blob_appendf(report, "EDITED %s\n", zDisplayName);
122 }
123
--- src/checkin.c
+++ src/checkin.c
@@ -113,10 +113,18 @@
113 blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
114 }else if( isChnged==4 ){
115 blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName);
116 }else if( isChnged==5 ){
117 blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName);
118 }else if( isChnged==6 ){
119 blob_appendf(report, "EXECUTABLE %s\n", zDisplayName);
120 }else if( isChnged==7 ){
121 blob_appendf(report, "SYMLINK %s\n", zDisplayName);
122 }else if( isChnged==8 ){
123 blob_appendf(report, "UNEXEC %s\n", zDisplayName);
124 }else if( isChnged==9 ){
125 blob_appendf(report, "UNLINK %s\n", zDisplayName);
126 }else if( file_contains_merge_marker(zFullName) ){
127 blob_appendf(report, "CONFLICT %s\n", zDisplayName);
128 }else{
129 blob_appendf(report, "EDITED %s\n", zDisplayName);
130 }
131
+35 -7
--- src/vfile.c
+++ src/vfile.c
@@ -136,15 +136,22 @@
136136
#define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */
137137
138138
#endif /* INTERFACE */
139139
140140
/*
141
-** Look at every VFILE entry with the given vid and update
142
-** VFILE.CHNGED field according to whether or not
143
-** the file has changed. 0 means no change. 1 means edited. 2 means
144
-** the file has changed due to a merge. 3 means the file was added
145
-** by a merge.
141
+** Look at every VFILE entry with the given vid and update VFILE.CHNGED field
142
+** according to whether or not the file has changed.
143
+** - 0 means no change.
144
+** - 1 means edited.
145
+** - 2 means changed due to a merge.
146
+** - 3 means added by a merge.
147
+** - 4 means changed due to an integrate merge.
148
+** - 5 means added by an integrate merge.
149
+** - 6 means became executable but has unmodified contents.
150
+** - 7 means became a symlink whose target equals its old contents.
151
+** - 8 means lost executable status but has unmodified contents.
152
+** - 9 means lost symlink status and has contents equal to its old target.
146153
**
147154
** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either
148155
** removed from configuration management via "fossil rm" or added via
149156
** "fossil add", respectively, and in both cases we always know that
150157
** the file has changed without having the check the size, mtime,
@@ -170,18 +177,22 @@
170177
int useMtime = (cksigFlags & CKSIG_SHA1)==0
171178
&& db_get_boolean("mtime-changes", 1);
172179
173180
db_begin_transaction();
174181
db_prepare(&q, "SELECT id, %Q || pathname,"
175
- " vfile.mrid, deleted, chnged, uuid, size, mtime"
182
+ " vfile.mrid, deleted, chnged, uuid, size, mtime,"
183
+ " CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END"
176184
" FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
177
- " WHERE vid=%d ", g.zLocalRoot, vid);
185
+ " WHERE vid=%d ", g.zLocalRoot, PERM_EXE, PERM_LNK, PERM_REG,
186
+ vid);
178187
while( db_step(&q)==SQLITE_ROW ){
179188
int id, rid, isDeleted;
180189
const char *zName;
181190
int chnged = 0;
182191
int oldChnged;
192
+ int origPerm;
193
+ int currentPerm;
183194
i64 oldMtime;
184195
i64 currentMtime;
185196
i64 origSize;
186197
i64 currentSize;
187198
@@ -192,10 +203,12 @@
192203
oldChnged = chnged = db_column_int(&q, 4);
193204
oldMtime = db_column_int64(&q, 7);
194205
origSize = db_column_int64(&q, 6);
195206
currentSize = file_wd_size(zName);
196207
currentMtime = file_wd_mtime(0);
208
+ origPerm = db_column_int(&q, 8);
209
+ currentPerm = file_wd_perm(zName);
197210
if( chnged==0 && (isDeleted || rid==0) ){
198211
/* "fossil rm" or "fossil add" always change the file */
199212
chnged = 1;
200213
}else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
201214
if( cksigFlags & CKSIG_ENOTFILE ){
@@ -245,10 +258,25 @@
245258
file_set_mtime(zName, desiredMtime);
246259
currentMtime = file_wd_mtime(zName);
247260
}
248261
}
249262
}
263
+#ifndef _WIN32
264
+ if( chnged==0 || chnged==6 || chnged==7 || chnged==8 || chnged==9 ){
265
+ if( origPerm == currentPerm ){
266
+ chnged = 0;
267
+ }else if( currentPerm == PERM_EXE ){
268
+ chnged = 6;
269
+ }else if( currentPerm == PERM_LNK ){
270
+ chnged = 7;
271
+ }else if( origPerm == PERM_EXE ){
272
+ chnged = 8;
273
+ }else if( origPerm == PERM_LNK ){
274
+ chnged = 9;
275
+ }
276
+ }
277
+#endif
250278
if( currentMtime!=oldMtime || chnged!=oldChnged ){
251279
db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
252280
currentMtime, chnged, id);
253281
}
254282
}
255283
--- src/vfile.c
+++ src/vfile.c
@@ -136,15 +136,22 @@
136 #define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */
137
138 #endif /* INTERFACE */
139
140 /*
141 ** Look at every VFILE entry with the given vid and update
142 ** VFILE.CHNGED field according to whether or not
143 ** the file has changed. 0 means no change. 1 means edited. 2 means
144 ** the file has changed due to a merge. 3 means the file was added
145 ** by a merge.
 
 
 
 
 
 
 
146 **
147 ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either
148 ** removed from configuration management via "fossil rm" or added via
149 ** "fossil add", respectively, and in both cases we always know that
150 ** the file has changed without having the check the size, mtime,
@@ -170,18 +177,22 @@
170 int useMtime = (cksigFlags & CKSIG_SHA1)==0
171 && db_get_boolean("mtime-changes", 1);
172
173 db_begin_transaction();
174 db_prepare(&q, "SELECT id, %Q || pathname,"
175 " vfile.mrid, deleted, chnged, uuid, size, mtime"
 
176 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
177 " WHERE vid=%d ", g.zLocalRoot, vid);
 
178 while( db_step(&q)==SQLITE_ROW ){
179 int id, rid, isDeleted;
180 const char *zName;
181 int chnged = 0;
182 int oldChnged;
 
 
183 i64 oldMtime;
184 i64 currentMtime;
185 i64 origSize;
186 i64 currentSize;
187
@@ -192,10 +203,12 @@
192 oldChnged = chnged = db_column_int(&q, 4);
193 oldMtime = db_column_int64(&q, 7);
194 origSize = db_column_int64(&q, 6);
195 currentSize = file_wd_size(zName);
196 currentMtime = file_wd_mtime(0);
 
 
197 if( chnged==0 && (isDeleted || rid==0) ){
198 /* "fossil rm" or "fossil add" always change the file */
199 chnged = 1;
200 }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
201 if( cksigFlags & CKSIG_ENOTFILE ){
@@ -245,10 +258,25 @@
245 file_set_mtime(zName, desiredMtime);
246 currentMtime = file_wd_mtime(zName);
247 }
248 }
249 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250 if( currentMtime!=oldMtime || chnged!=oldChnged ){
251 db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
252 currentMtime, chnged, id);
253 }
254 }
255
--- src/vfile.c
+++ src/vfile.c
@@ -136,15 +136,22 @@
136 #define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */
137
138 #endif /* INTERFACE */
139
140 /*
141 ** Look at every VFILE entry with the given vid and update VFILE.CHNGED field
142 ** according to whether or not the file has changed.
143 ** - 0 means no change.
144 ** - 1 means edited.
145 ** - 2 means changed due to a merge.
146 ** - 3 means added by a merge.
147 ** - 4 means changed due to an integrate merge.
148 ** - 5 means added by an integrate merge.
149 ** - 6 means became executable but has unmodified contents.
150 ** - 7 means became a symlink whose target equals its old contents.
151 ** - 8 means lost executable status but has unmodified contents.
152 ** - 9 means lost symlink status and has contents equal to its old target.
153 **
154 ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either
155 ** removed from configuration management via "fossil rm" or added via
156 ** "fossil add", respectively, and in both cases we always know that
157 ** the file has changed without having the check the size, mtime,
@@ -170,18 +177,22 @@
177 int useMtime = (cksigFlags & CKSIG_SHA1)==0
178 && db_get_boolean("mtime-changes", 1);
179
180 db_begin_transaction();
181 db_prepare(&q, "SELECT id, %Q || pathname,"
182 " vfile.mrid, deleted, chnged, uuid, size, mtime,"
183 " CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END"
184 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
185 " WHERE vid=%d ", g.zLocalRoot, PERM_EXE, PERM_LNK, PERM_REG,
186 vid);
187 while( db_step(&q)==SQLITE_ROW ){
188 int id, rid, isDeleted;
189 const char *zName;
190 int chnged = 0;
191 int oldChnged;
192 int origPerm;
193 int currentPerm;
194 i64 oldMtime;
195 i64 currentMtime;
196 i64 origSize;
197 i64 currentSize;
198
@@ -192,10 +203,12 @@
203 oldChnged = chnged = db_column_int(&q, 4);
204 oldMtime = db_column_int64(&q, 7);
205 origSize = db_column_int64(&q, 6);
206 currentSize = file_wd_size(zName);
207 currentMtime = file_wd_mtime(0);
208 origPerm = db_column_int(&q, 8);
209 currentPerm = file_wd_perm(zName);
210 if( chnged==0 && (isDeleted || rid==0) ){
211 /* "fossil rm" or "fossil add" always change the file */
212 chnged = 1;
213 }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
214 if( cksigFlags & CKSIG_ENOTFILE ){
@@ -245,10 +258,25 @@
258 file_set_mtime(zName, desiredMtime);
259 currentMtime = file_wd_mtime(zName);
260 }
261 }
262 }
263 #ifndef _WIN32
264 if( chnged==0 || chnged==6 || chnged==7 || chnged==8 || chnged==9 ){
265 if( origPerm == currentPerm ){
266 chnged = 0;
267 }else if( currentPerm == PERM_EXE ){
268 chnged = 6;
269 }else if( currentPerm == PERM_LNK ){
270 chnged = 7;
271 }else if( origPerm == PERM_EXE ){
272 chnged = 8;
273 }else if( origPerm == PERM_LNK ){
274 chnged = 9;
275 }
276 }
277 #endif
278 if( currentMtime!=oldMtime || chnged!=oldChnged ){
279 db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
280 currentMtime, chnged, id);
281 }
282 }
283
--- www/changes.wiki
+++ www/changes.wiki
@@ -30,13 +30,16 @@
3030
leaves on the same branch.
3131
* Added the "Blitz" skin option.
3232
* Removed the ".fossil-settings/keep-glob" file. It should not have been
3333
checked into the repository.
3434
* Update the built-in SQLite to version 3.8.10.1.
35
- * Made [/help?cmd=open|fossil open] honor ".fossil-settings/allow-symlinks".
35
+ * Make [/help?cmd=open|fossil open] honor ".fossil-settings/allow-symlinks".
3636
* Allow [/help?cmd=add|fossil add] to be used on symlinks to nonexistent or
3737
unreadable files in the same way as [/help?cmd=addremove|fossil addremove].
38
+ * Have [/help/cmd=changes|fossil changes] and
39
+ [/help/cmd=status|fossil status] report when executable or symlink status
40
+ changes on otherwise unmodified files.
3841
3942
<h2>Changes for Version 1.32 (2015-03-14)</h2>
4043
* When creating a new repository using [/help?cmd=init|fossil init], ensure
4144
that the new repository is fully compatible with historical versions of
4245
Fossil by having a valid manifest as RID 1.
4346
--- www/changes.wiki
+++ www/changes.wiki
@@ -30,13 +30,16 @@
30 leaves on the same branch.
31 * Added the "Blitz" skin option.
32 * Removed the ".fossil-settings/keep-glob" file. It should not have been
33 checked into the repository.
34 * Update the built-in SQLite to version 3.8.10.1.
35 * Made [/help?cmd=open|fossil open] honor ".fossil-settings/allow-symlinks".
36 * Allow [/help?cmd=add|fossil add] to be used on symlinks to nonexistent or
37 unreadable files in the same way as [/help?cmd=addremove|fossil addremove].
 
 
 
38
39 <h2>Changes for Version 1.32 (2015-03-14)</h2>
40 * When creating a new repository using [/help?cmd=init|fossil init], ensure
41 that the new repository is fully compatible with historical versions of
42 Fossil by having a valid manifest as RID 1.
43
--- www/changes.wiki
+++ www/changes.wiki
@@ -30,13 +30,16 @@
30 leaves on the same branch.
31 * Added the "Blitz" skin option.
32 * Removed the ".fossil-settings/keep-glob" file. It should not have been
33 checked into the repository.
34 * Update the built-in SQLite to version 3.8.10.1.
35 * Make [/help?cmd=open|fossil open] honor ".fossil-settings/allow-symlinks".
36 * Allow [/help?cmd=add|fossil add] to be used on symlinks to nonexistent or
37 unreadable files in the same way as [/help?cmd=addremove|fossil addremove].
38 * Have [/help/cmd=changes|fossil changes] and
39 [/help/cmd=status|fossil status] report when executable or symlink status
40 changes on otherwise unmodified files.
41
42 <h2>Changes for Version 1.32 (2015-03-14)</h2>
43 * When creating a new repository using [/help?cmd=init|fossil init], ensure
44 that the new repository is fully compatible with historical versions of
45 Fossil by having a valid manifest as RID 1.
46

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button