Fix rbt patch sending prefix levels as strings.
Review Request #14254 — Created Dec. 3, 2024 and submitted — Latest diff uploaded
The work done on the new patcher was meant to avoid the case where
strings were used instead of integers for path prefix levels. However,
the work here was incomplete.
SCMClient.apply_patch()
does normalize strings to integers, which is
correct when applying patches using that method. For a brief period of
time, Subversion (which was susceptible to the string prefix level bug)
benefited from this, but when it was converted toPatcher
, this
workaround was lost. It's worth noting thatapply_patch()
, for
historical reasons, does expect a string, but not all SCMs handled
this right.A core issue here was that
rbt patch --px
was configured to save the
value as a string, not an integer. Still, though, given
apply_patch()
's expectations, this wasn't technically incorrect until
now. With the newPatcher
API, we do now set this to store as an
integer explicitly, and assert this.
Patch()
has been updated to decode string-wrapped integers, with a
deprecation warning. This ensures that any other calls that result in a
Patch
object will normalize to the right type.
Unit tests pass.
Manually tested
rbt patch --px
with integers, invalid values, and with
the argument omitted.