Fossil SCM

Fix reverting the combination of a renamed file and an added file that uses the renamed file's original filename. (This previously failed on a UNIQUE constraint.)

joel 2014-02-23 05:15 trunk
Commit bd0b09e50b80461e13c6d2fbdf7d6b4aba128f98
2 files changed +1 -1 +19
+1 -1
--- src/update.c
+++ src/update.c
@@ -764,11 +764,11 @@
764764
undo_save(zFile);
765765
file_delete(zFull);
766766
fossil_print("DELETE: %s\n", zFile);
767767
}
768768
db_multi_exec(
769
- "UPDATE vfile"
769
+ "UPDATE OR REPLACE vfile"
770770
" SET pathname=origname, origname=NULL"
771771
" WHERE pathname=%Q AND origname!=pathname;"
772772
"DELETE FROM vfile WHERE pathname=%Q",
773773
zFile, zFile
774774
);
775775
--- src/update.c
+++ src/update.c
@@ -764,11 +764,11 @@
764 undo_save(zFile);
765 file_delete(zFull);
766 fossil_print("DELETE: %s\n", zFile);
767 }
768 db_multi_exec(
769 "UPDATE vfile"
770 " SET pathname=origname, origname=NULL"
771 " WHERE pathname=%Q AND origname!=pathname;"
772 "DELETE FROM vfile WHERE pathname=%Q",
773 zFile, zFile
774 );
775
--- src/update.c
+++ src/update.c
@@ -764,11 +764,11 @@
764 undo_save(zFile);
765 file_delete(zFull);
766 fossil_print("DELETE: %s\n", zFile);
767 }
768 db_multi_exec(
769 "UPDATE OR REPLACE vfile"
770 " SET pathname=origname, origname=NULL"
771 " WHERE pathname=%Q AND origname!=pathname;"
772 "DELETE FROM vfile WHERE pathname=%Q",
773 zFile, zFile
774 );
775
--- test/revert.test
+++ test/revert.test
@@ -134,5 +134,24 @@
134134
} -changes {
135135
DELETED f1
136136
} -addremove {
137137
ADDED f0
138138
} -exists {f0 f2 f3} -notexists {f1 f3n}
139
+
140
+
141
+# Test reverting the combination of a renamed file and an added file that
142
+# uses the renamed file's original filename.
143
+#
144
+repo_init
145
+write_file f1 "f1"
146
+fossil add f1
147
+fossil commit -m "add f1"
148
+
149
+write_file f1n "f1n"
150
+fossil mv f1 f1n
151
+write_file f1 "f1b"
152
+fossil add f1
153
+
154
+revert-test 2-1 {} {
155
+ REVERTED: f1
156
+ DELETE: f1n
157
+} -exists {f1} -notexists {f1n}
139158
--- test/revert.test
+++ test/revert.test
@@ -134,5 +134,24 @@
134 } -changes {
135 DELETED f1
136 } -addremove {
137 ADDED f0
138 } -exists {f0 f2 f3} -notexists {f1 f3n}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
--- test/revert.test
+++ test/revert.test
@@ -134,5 +134,24 @@
134 } -changes {
135 DELETED f1
136 } -addremove {
137 ADDED f0
138 } -exists {f0 f2 f3} -notexists {f1 f3n}
139
140
141 # Test reverting the combination of a renamed file and an added file that
142 # uses the renamed file's original filename.
143 #
144 repo_init
145 write_file f1 "f1"
146 fossil add f1
147 fossil commit -m "add f1"
148
149 write_file f1n "f1n"
150 fossil mv f1 f1n
151 write_file f1 "f1b"
152 fossil add f1
153
154 revert-test 2-1 {} {
155 REVERTED: f1
156 DELETE: f1n
157 } -exists {f1} -notexists {f1n}
158

Keyboard Shortcuts

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