Fossil

Check-in [b1dd95c7]
Login

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

Overview
Comment:Add some tests for -close and -hide.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | check-in-edit
Files: files | file ages | folders
SHA1: b1dd95c7d9645bf4d3fca750b7ad99ef7cf76843
User & Date: andybradford 2015-08-01 06:46:45.830
Context
2015-08-02
04:16
If the UUID is not legitimate or cannot be found, return an error. ... (check-in: e4b5c2c2 user: andybradford tags: check-in-edit)
2015-08-01
06:46
Add some tests for -close and -hide. ... (check-in: b1dd95c7 user: andybradford tags: check-in-edit)
06:40
Make -close and -hide no-ops if the checkin already has those tags. ... (check-in: 1c8fdd25 user: andybradford tags: check-in-edit)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/amend.test.
9
10
11
12
13
14
15


16
17
18
19
20
21
22
# Setup: Add file and commit           #
########################################
write_file datafile "data"
write_file commitmsg "committed"

fossil add datafile
fossil commit -m "c1"


if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID]} {
  test amend-setup-failure false
  return
}

########################################
# Test: -branch                        #







>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Setup: Add file and commit           #
########################################
write_file datafile "data"
write_file commitmsg "committed"

fossil add datafile
fossil commit -m "c1"
write_file datafile "data.file"
fossil commit -m "c2"
if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID]} {
  test amend-setup-failure false
  return
}

########################################
# Test: -branch                        #
125
126
127
128
129
130
131
132
133















































  "%d/%m/%Y"
}
set sc 0
foreach badformat $badformats {
  incr sc
  set datetime [clock format $timestamp -format $badformat -gmt 1]
  fossil amend $UUID -date $datetime
  test amend-date-2.$sc {[string first "Unsupported date format, use YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
}






















































|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
  "%d/%m/%Y"
}
set sc 0
foreach badformat $badformats {
  incr sc
  set datetime [clock format $timestamp -format $badformat -gmt 1]
  fossil amend $UUID -date $datetime
  test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
}

########################################
# Test: -hide                          #
########################################
fossil amend $UUID -hide
test amend-hide-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
fossil tag ls --raw $UUID
test amend-hide-1.2 {[string first "hidden" $RESULT] != -1}
fossil timeline -n 1
test amend-hide-1.3 {[string match {*Add*propagating*"hidden".*} $RESULT]}

########################################
# Test: -close                          #
########################################
fossil amend $UUID -close
test amend-close-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
fossil tag ls --raw $UUID
test amend-close-1.2 {[string first "closed" $RESULT] != -1}
fossil timeline -n 1
test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]}
write_file datafile "changed"
fossil commit -m "should fail"
test amend-close-2 {[string first "closed leaf" $RESULT] != -1}

fossil revert
fossil update trunk
write_file datafile "cb"
fossil commit -m "closed-branch" --branch "closebranch"
if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID3]} {
  test amend-close-3.all false
} else {
  write_file datafile "b1"
  fossil commit -m "m1"
  write_file datafile "b2"
  fossil commit -m "m2"
  fossil amend $UUID3 --close
  test amend-close-3.1 {[string match "*uuid:*$UUID3*" $RESULT]}
  fossil tag ls --raw current
  test amend-close-3.2 {[string first "closed" $RESULT] != -1}
  fossil timeline -n 1
  test amend-close-3.3 {
    [string match "*Add*propagating*\"closed\".*" $RESULT]
  }
  write_file datafile "changed"
  fossil commit -m "should fail"
  test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1}
}