comparison tests/test-topic.t @ 5687:d24669df9a4a

topic: look for topic heads only when necessary Before this patch, if repo.branchheads() were asked to return heads of a branch and if there is any active topic, it would append that topic name to branch name and search heads for it and return wrong results. Because of this behavior we get wrong results for "hg heads" command because, this command make a list of heads of each branch in branchmap. So if wdir parent has an active topic, it would search for "branch:topic" instead of "branch" for each branch. Now we append topic only when branch is not passed to the function. Changes in test-topic.t file reflect the fixed behavior. Changes in test-topic-stack-data.t are obvious but not correct for `hg sum` output, which is because that's what the expected behavior acc. to the current logic in `hg sum` as it looks for the heads of branch of wdir parent and calculate new commits like this: new = ancestor(all branch heads) - ancestor(current parent) So, it doesn't really care if wdir parent has a topic which is why we are getting wrong result for "update:" in `hg sum`. You might be wondering why it was returning the correct output before, but I digged into it and can tell you that it's just a false combination of current cset and code bits which gave the correct results. If we want to correctly fix the issue we probably need to wrap `hg sum` command.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Tue, 01 Dec 2020 00:56:39 +0530
parents ff84b99569b0
children 61d2f1cf90f0
comparison
equal deleted inserted replaced
5686:ff84b99569b0 5687:d24669df9a4a
1196 date: Thu Jan 01 00:00:00 1970 +0000 1196 date: Thu Jan 01 00:00:00 1970 +0000
1197 summary: Added tag 1.0 for changeset 3bbb3fdb2546 1197 summary: Added tag 1.0 for changeset 3bbb3fdb2546
1198 1198
1199 $ hg topic foo 1199 $ hg topic foo
1200 marked working directory as topic: foo 1200 marked working directory as topic: foo
1201 XXX: it should have returned both the heads; will be fixed in next patch
1202 $ hg heads 1201 $ hg heads
1202 changeset: 4:29edef26570b
1203 tag: tip
1204 parent: 0:9092f1db7931
1205 user: test
1206 date: Thu Jan 01 00:00:00 1970 +0000
1207 summary: added c
1208
1203 changeset: 3:9efc5c3ac635 1209 changeset: 3:9efc5c3ac635
1204 topic: foo 1210 topic: foo
1205 user: test 1211 user: test
1206 date: Thu Jan 01 00:00:00 1970 +0000 1212 date: Thu Jan 01 00:00:00 1970 +0000
1207 summary: Added tag 1.0 for changeset 3bbb3fdb2546 1213 summary: Added tag 1.0 for changeset 3bbb3fdb2546
1208 1214
1209 1215
1210 $ hg up foo 1216 $ hg up foo
1211 2 files updated, 0 files merged, 1 files removed, 0 files unresolved 1217 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1212 XXX: it should have returned both the heads; will be fixed in next patch
1213 $ hg heads 1218 $ hg heads
1219 changeset: 4:29edef26570b
1220 tag: tip
1221 parent: 0:9092f1db7931
1222 user: test
1223 date: Thu Jan 01 00:00:00 1970 +0000
1224 summary: added c
1225
1214 changeset: 3:9efc5c3ac635 1226 changeset: 3:9efc5c3ac635
1215 topic: foo 1227 topic: foo
1216 user: test 1228 user: test
1217 date: Thu Jan 01 00:00:00 1970 +0000 1229 date: Thu Jan 01 00:00:00 1970 +0000
1218 summary: Added tag 1.0 for changeset 3bbb3fdb2546 1230 summary: Added tag 1.0 for changeset 3bbb3fdb2546