------------------------------------------------------------------------------
To reply, visit https://hellosplat.com/s/beanbag/tickets/4973/
------------------------------------------------------------------------------

New ticket #4973 by rpowell
For Beanbag, Inc. > RBTools

Status: New
Tags: Priority:Medium, Type:Defect


------------------------------------------------------------------------------
rbt patch - SVN
==============================================================================

# What version are you running?
$ rbt --version
RBTools 3.1.1 alpha 0 (dev) (Python 3.10.4)

$ svn --version
svn, version 1.14.1 (r1886195)
   compiled May 21 2022, 10:52:35 on x86_64-pc-linux-gnu

# What steps will reproduce the problem?
1. Use rbt patch <number> to apply an SVN patch.  

# What is the expected output? What do you see instead?
Expected output
Applying 1 patch ...

Actual output:

$ rbt patch 269193
Applying 1 patch from review request 269193 (diff revision 5)

CRITICAL: a bytes-like object is required, not 'str'


# What operating system are you using?
Ubuntu 22.04


# Attach the debug out from the command.

```
$ rbt <command> --debug <args><snip>
>>> Making HTTP GET request to 
>>> https://<server>/api/review-requests/269193/?force-text-type=plain
>>> Cached response for HTTP GET 
>>> https://<server>/api/review-requests/269193/?force-text-type=plain expired 
>>> and was not modified
Applying 1 patch from review request 269193 (diff revision 5)
>>> Running: svn --non-interactive patch --strip=3 /tmp/rbtools.z81jtd4j

Traceback (most recent call last):
  File "/home/bpowell/dev/rbt/rb_venv/bin/rbt", line 33, in <module>
    sys.exit(load_entry_point('RBTools', 'console_scripts', 'rbt')())
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/main.py", line 207, in 
main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/__init__.py", line 1096, 
in run_from_argv
    exit_code = self.main(*args) or 0
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/patch.py", line 536, in 
main
    self._apply_patches(patches)
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/patch.py", line 635, in 
_apply_patches
    success = self.apply_patch(
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/patch.py", line 363, in 
apply_patch
    self.stdout_bytes.write(patch_output)
  File "/home/bpowell/dev/rbt/rbtools/rbtools/commands/__init__.py", line 192, 
in write
    self.output_stream.write(msg)
TypeError: a bytes-like object is required, not 'str'
```


# Please provide any additional information below.
The following diff appears to resolve the issue

```
$ diff commands/patch.py ../rbt/rbtools/rbtools/commands/patch.py 
363,366c363
<                 if isinstance(patch_output, str):
<                     self.stdout.write(patch_output)
<                 else:
<                     self.stdout_bytes.write(patch_output)
---
>                 self.stdout_bytes.write(patch_output)
```
Locale settings
```
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
```

Issue may have been introduced under this was likely introduced in: 
https://github.com/reviewboard/rbtools/commit/db0c1f5b3a0ed3e132b7102c8173ab8b8ac0bc3a#diff-dbd3ec45e4478c9f27f9db6c6cfadb5d64d436dadfed8771a7c689f657b2d4c1

------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard-issues/20220615012636.15760.70112%40ip-10-1-54-209.ec2.internal.

Reply via email to