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

New update by KG
For Beanbag, Inc. > RBTools > Ticket #4728


Reply:

    I encountered this problem also, and have two additional data points to add:
    
    1) If one does a fresh "git svn clone" operation, followed by "rbt post" in 
the resulting repository, the `git rev-parse SHA2_first_commit_on_remote^` 
problem does not occurr. It only fails in an older repo created by an older 
git-svn. (Aside: why would it be asking for a commit older than the first 
commit?)
    
    2) However there is a subsequent failure, which occurs for both `rbt post` 
and `rbt diff`. The issue is that `git svn find-rev` returns a string, rather 
than bytes. This causes `make_svn_diff` to abort:
    
    ```
    >>> RBTools 1.0.1                                                           
                                                                                
                                                                                
                                                
    >>> Python 3.6.6 (default, Jul 19 2018, 14:25:17)                           
                                                                                
                                                                                
                                                
    [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]
    >>> Running on 
Linux-4.18.9-200.fc28.x86_64-x86_64-with-fedora-28-Twenty_Eight
    [...snip...]
    >>> Running: git rev-parse refs/heads/master
    >>> Running: git rev-parse origin/trunk
    >>> Running: git rev-list 25928235d653cdfb768073a943b044cd828d7203 --not 
--remotes=origin
    >>> Running: git status --porcelain --untracked-files=no 
--ignore-submodules=dirty
    >>> Running: git version
    >>> Running: git -c core.quotepath=false diff --no-color --no-prefix -r -u 
--no-ext-diff 
25928235d653cdfb768073a943b044cd828d7203..cd4f09a13b2c0c9b95e1bd5baa1e5ec1e2de134e
    >>> Running: git svn find-rev 25928235d653cdfb768073a943b044cd828d7203
    Traceback (most recent call last):
      File "/usr/bin/rbt", line 11, in <module>
        load_entry_point('RBTools==1.0.1', 'console_scripts', 'rbt')()
      File "/usr/lib/python3.6/site-packages/rbtools/commands/main.py", line 
120, in main
        command.run_from_argv([RB_MAIN, command_name] + args)
      File "/usr/lib/python3.6/site-packages/rbtools/commands/__init__.py", 
line 719, in run_from_argv
        exit_code = self.main(*args) or 0
      File "/usr/lib/python3.6/site-packages/rbtools/commands/diff.py", line 
70, in main
        extra_args=extra_args)
      File "/usr/lib/python3.6/site-packages/rbtools/clients/git.py", line 634, 
in diff
        exclude_patterns)
      File "/usr/lib/python3.6/site-packages/rbtools/clients/git.py", line 778, 
in make_diff
        return self.make_svn_diff(merge_base, diff_lines)
      File "/usr/lib/python3.6/site-packages/rbtools/clients/git.py", line 834, 
in make_svn_diff
        diff_data += b'--- %s\t(revision %s)\n' % (original_file, rev)
    TypeError: %b requires a bytes-like object, or an object that implements 
__bytes__, not 'str'
    ```
    
    I don't know if it is the right place to fix it, but the following change 
at the beginning of `make_svn_diff` solves the problem:
    
    ```
            Returns:
                bytes:
                The reformatted diff contents.
            """
            rev = self._execute([self.git, 'svn', 'find-rev', 
merge_base]).strip()
    +       rev = rev.encode()  #todo: make it safe for python2.7 also
    
            if not rev:
                return None
    ```
    
    With the above change, I am able to successfully `rbt post` from a git-svn 
repo.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.

Reply via email to