Re: RBTools Ticket #4871: Unable to rbt post when using subversion after renaming a file

2020-05-15 Thread Paul Fee
--
To reply, visit https://hellosplat.com/s/beanbag/tickets/4871/
--

New update by pfee
For Beanbag, Inc. > RBTools > Ticket #4871


Reply:

Markdown has adjust some of the above text, hopefully the content and patch 
are still readable.  Shame splat has no button to disable markdown like 
ReviewBoard has.

-- 
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 reviewboard-issues+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard-issues/20200515153634.3562.90160%40ip-10-1-54-209.ec2.internal.


RBTools Ticket #4871: Unable to rbt post when using subversion after renaming a file

2020-05-15 Thread Paul Fee
--
To reply, visit https://hellosplat.com/s/beanbag/tickets/4871/
--

New ticket #4871 by pfee
For Beanbag, Inc. > RBTools

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


--
Unable to rbt post when using subversion after renaming a file
==

# What version are you running?
OpenSUSE Tumbleweed (w/updates as of 15 May 2020)
SVN 1.13.0
Python 3.8.2
RBTools 1.0.2

# What steps will reproduce the problem?
1. Make changes in an SVN sandbox, including renaming a file with "svn mv".
2. Post the changes for review using "rbt post -d --svn-show-copies-as-adds=n"
3. Posting fails due to python exception

# What is the expected output? What do you see instead?
Expect "Review request #xyz posted."

Instead see Python exception and stacktrace:


>>> Running: svn --non-interactive diff --diff-cmd=diff --notice-ancestry -r 
>>> BASE --no-diff-deleted
Traceback (most recent call last):
  File "/usr/bin/rbt", line 11, in 
load_entry_point('RBTools==1.0.2', 'console_scripts', 'rbt')()
  File "/usr/lib/python3.8/site-packages/rbtools/commands/main.py", line 120, 
in main
command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/lib/python3.8/site-packages/rbtools/commands/__init__.py", line 
725, in run_from_argv
exit_code = self.main(*args) or 0
  File "/usr/lib/python3.8/site-packages/rbtools/commands/post.py", line 802, 
in main
diff_info = self.tool.diff(
  File "/usr/lib/python3.8/site-packages/rbtools/clients/svn.py", line 517, in 
diff
diff = self._handle_empty_files(diff, diff_cmd,
  File "/usr/lib/python3.8/site-packages/rbtools/clients/svn.py", line 789, in 
_handle_empty_files
result.append(b'--- %s\t%s\n' % (filename.encode(_fs_encoding),
AttributeError: 'bytes' object has no attribute 'encode'

# What operating system are you using?
Linux, openSUSE Tumbleweed.  Distro packaged versions of RBTools, python3 and 
subversion.


# Please provide any additional information below.
Debugged this using python debugger: python3 -m pdb /usr/bin/rbt post -d 
--svn-show-copies-as-adds=n

(Pdb) b /usr/lib/python3.8/site-packages/rbtools/clients/svn.py:789

Relevant code:
 788 result.append(b'%s\n' % self.INDEX_SEP)
 789 result.append(b'--- %s\t%s\n' % 
(filename.encode(_fs_encoding),
 790  base.encode('utf-8')))
 791 result.append(b'+++ %s\t%s\n' % 
(filename.encode(_fs_encoding),
 792  tip.encode('utf-8')))

The "filename" variable is of type "bytes", rather than "str", hence doesn't 
have a .encode() method.

Removing this .encode() call allowed the "rbt post" to work as expected.  The 
contents of filename comes from the "diff_content", so I suspect it will always 
by of type "bytes", though I haven't tested the fix below extensively.

PATCH
=

$ diff -u /usr/lib/python3.8/site-packages/rbtools/clients/svn.py.orig 
/usr/lib/python3.8/site-packages/rbtools/clients/svn.py
--- /usr/lib/python3.8/site-packages/rbtools/clients/svn.py.orig
2020-05-15 16:10:03.876230238 +0100
+++ /usr/lib/python3.8/site-packages/rbtools/clients/svn.py 2020-05-15 
16:12:36.331769935 +0100
@@ -786,9 +786,9 @@
 tip = revisions['tip']
 
 result.append(b'%s\n' % self.INDEX_SEP)
-result.append(b'--- %s\t%s\n' % (filename.encode(_fs_encoding),
+result.append(b'--- %s\t%s\n' % (filename,
  base.encode('utf-8')))
-result.append(b'+++ %s\t%s\n' % (filename.encode(_fs_encoding),
+result.append(b'+++ %s\t%s\n' % (filename,
  tip.encode('utf-8')))
 
 # Skip the next line (the index separator) since we've already

--

-- 
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 reviewboard-issues+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard-issues/20200515153315.3567.78514%40ip-10-1-54-209.ec2.internal.