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

New ticket #4587 by totoroliu
For Beanbag, Inc. > RBTools

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

File attachments:

 * rb20459.patch
   <https://hellosplat.com/s/beanbag/attachments/1258/>



------------------------------------------------------------------------------
rbt patch failed to work for svn merge change
==============================================================================

# What version are you running?
RBTools 0.7.10
svn, version 1.9.3 (r1718519)

# What steps will reproduce the problem?
1. Prepare 2 SVN branches: 
merge-source branch and merge-destination branch, 
where SVN Relative URL level must be different.
eg.
http://xxx.com/svn/svntest/TestProject/trunk
http://xxx.com/svn/svntest/TestProject/branches/4.x/br_4-0_test02/trunk


////////////////////////////
/ Prepare svn merge change /
////////////////////////////
2. At the merge-source branch, create a new folder and a new file that 
merge-destination branch doesn't have.
eg.
```
$ svn diff
Index: test/test01
===================================================================
--- test/test01 (nonexistent)
+++ test/test01 (revision 19438)
@@ -0,0 +1 @@
+test01
```

3. At the merge-source branch, commit the change above:
```
svn commit
```

//////////////////////////////////
/ Prepare reviewboard patch file /
//////////////////////////////////
4. At the merge-destination branch, run:
```
svn merge -c $REVISION $merge-source_branch_url
```

5. At the merge-destination branch, run rbt diff --svn-show-copies-as-adds=y
```
$ rbt diff --svn-show-copies-as-adds=y --debug
$ rbt diff --svn-show-copies-as-adds=y --debug
>>> RBTools 0.7.10
>>> Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609]
>>> Running on Linux-4.4.0-96-generic-x86_64-with-Ubuntu-16.04-xenial
>>> Home = /home/rickliu
>>> Current directory = /tmp/br_4-0_rtest02_trunk
>>> Command line: rbt diff --svn-show-copies-as-adds=y --debug
>>> Running: tf vc help
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> repository info: Path: http://xxx.com/svn/svntest, Base path: 
>>> /TestProject/branches/4.x/br_4-0_test02/trunk, Supports changesets: False
>>> Making HTTP GET request to http://172.16.182.156/api/
>>> Running: svn --non-interactive info
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> repository info: Path: http://xxx.com/svn/svntest, Base path: 
>>> /TestProject/branches/4.x/br_4-0_test02/trunk, Supports changesets: False
>>> Running: svn --non-interactive diff --diff-cmd=diff --notice-ancestry -r 
>>> BASE --show-copies-as-adds
>>> Running: svn --non-interactive info test/test01
>>> Running: svn --non-interactive info test
>>> Running: svn --non-interactive info .
>>> Running: svn --non-interactive diff --diff-cmd=diff --notice-ancestry -r 
>>> BASE --show-copies-as-adds --no-diff-deleted
>>> Running: svn --non-interactive info test/test01
>>> Running: svn --non-interactive info test/test01
>>> Running: svn --non-interactive info .
>>> Running: svn --non-interactive info .
>>> Running: svn --non-interactive info .
Index: /TestProject/branches/4.x/br_4-0_test02/trunk/test/test01
===================================================================
--- /TestProject/trunk/test/test01      (nonexistent)
+++ /TestProject/branches/4.x/br_4-0_test02/trunk/test/test01   (working copy)
@@ -0,0 +1 @@
+test01
Index: /TestProject/branches/4.x/br_4-0_test02/trunk
===================================================================
--- /TestProject/branches/4.x/br_4-0_test02/trunk       (revision 19436)
+++ /TestProject/branches/4.x/br_4-0_test02/trunk       (working copy)

Property changes on: .
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /TestProject/trunk:r19438

```

////////////
/ rbt post /
////////////
5. Post and publish the change to Reviewboard server

/////////////
/ rbt patch /
/////////////
6. At different local directory, svn checkout merge-destination branch again.
7. At merge-destination branch, run rbt patch:
```
$ rbt patch --debug 20459
>>> RBTools 0.7.10
>>> Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609]
>>> Running on Linux-4.4.0-96-generic-x86_64-with-Ubuntu-16.04-xenial
>>> Home = /home/rickliu
>>> Current directory = /tmp/br_4-0_test02_trunk
>>> Command line: rbt patch --debug 20459
>>> Running: tf vc help
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> repository info: Path: http://xxxx.com/svn/svntest, Base path: 
>>> /TestProject/branches/4.x/br_4-0_test02/trunk, Supports changesets: False
>>> Making HTTP GET request to http://172.16.182.156/api/
>>> Making HTTP GET request to 
>>> http://172.16.182.156/api/repositories/?tool=Subversion
>>> Cached response for HTTP GET 
>>> http://172.16.182.156/api/repositories/?tool=Subversion expired and was 
>>> modified
>>> Making HTTP GET request to 
>>> http://172.16.182.156/api/review-requests/20459/diffs/
>>> Cached response for HTTP GET 
>>> http://172.16.182.156/api/review-requests/20459/diffs/ expired and was 
>>> modified
>>> Making HTTP GET request to 
>>> http://172.16.182.156/api/review-requests/20459/diffs/1/
>>> Cached response for HTTP GET 
>>> http://172.16.182.156/api/review-requests/20459/diffs/1/ expired and was 
>>> not modified
>>> Making HTTP GET request to 
>>> http://172.16.182.156/api/review-requests/20459/diffs/1/
>>> Cached response for HTTP GET 
>>> http://172.16.182.156/api/review-requests/20459/diffs/1/ expired and was 
>>> not modified
Patch is being applied from request 20459 with diff revision 1.
>>> Running: svn --non-interactive patch --strip=6 /tmp/tmpsLJ9Sd
Traceback (most recent call last):
  File "/usr/local/bin/rbt", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/main.py", line 
133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/__init__.py", 
line 678, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/patch.py", line 
196, in main
    revert=self.options.revert_patch)
  File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/patch.py", line 
101, in apply_patch
    base_dir, self.options.px, revert=revert)
  File "/usr/local/lib/python2.7/dist-packages/rbtools/clients/svn.py", line 
797, in apply_patch
    rc, patch_output = self._run_svn(cmd, return_error_code=True)
  File "/usr/local/lib/python2.7/dist-packages/rbtools/clients/svn.py", line 
881, in _run_svn
    return execute(cmdline, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/rbtools/utils/process.py", line 
161, in execute
    raise Exception('Failed to execute command: %s\n%s' % (command, data))
Exception: Failed to execute command: ['svn', '--non-interactive', u'patch', 
u'--strip=6', u'/tmp/tmpsLJ9Sd']
svn: E195018: Cannot strip 6 components from 
'/TestProject/trunk_rick/test/test01'
```




# What is the expected output? What do you see instead?
rbt patch should correctly patch the change according to the diff file,
but received python exception.


# What operating system are you using?
Ubuntu 16.04.03 LTS


# Attach the debug out from the command.

```
$ rbt <command> --debug <args><debug output>
```


# Please provide any additional information below.
The root cause of this issue is the DIFF generated from "rbt diff" has 
different level of strip.



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

-- 
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