5

I want to post an SVN diff to the review board; the diff is generated between the branch HEAD and the base tag.

I used this command to generate the diff file :

svn diff https:/path/to/branch/head https:/path/to/tag

note that

  • i tried to use rbt diff revision1:revision2 command to generate the diff. I have a problem that review board only accepts revision range within the branch commits only (not accepting revision from tags).

  • i tried to diff using the svn diff command then upload the file using rbt post --diff-filename but the command returned with an error requiring a base directory; i added the base dir to to be the root using rbt post --basedir https:/path/to/root ; the review boards accept but shows the diff on the web page like a diff between https:/path/to/root/branches/featureName/path/to/changed/files and https:/path/to/root/path/to/changed/files without showing that the diff is between branch and a tag like https:/path/to/root/tag/path/to/changed/files.

is there any way to do such job ?

Muhammad Yusuf
  • 397
  • 1
  • 15
  • Were you able to generate required diff file using SVN diff? I think you have only problem in uploading the same to review-board, is that right? – Sunilkumar V Jul 29 '15 at 19:28
  • yes, i am able to generate diff file using SVN diff. when trying to upload the diff file to review-board but error messages appeared error message example: _/path/to/folder/branches/development/feature/branches/development/feature/path/to/file.py: The file was not found in the repository. (HTTP 400, API Error 207)_ as you can see the review board repeat the path to branch twice which is no correct; it is expected to have a path like _/path/to/folder/branches/development/feature/path/to/file.py_ somehow a problem between SVN diff file and review-board parsing; which i don't know thanks @Sukuva – Muhammad Yusuf Aug 03 '15 at 16:26
  • Can you try generating diff from the root of the repository rather than individual file? The root should be same as your review board base url – Sunilkumar V Aug 03 '15 at 17:38
  • One thing you have to make sure is the "base path" between the top of the repository and the path in which the diffs were generated – Sunilkumar V Aug 04 '15 at 13:45
  • i hope the ticket is more clear after editing it. – Muhammad Yusuf Aug 04 '15 at 17:49

1 Answers1

1

You can post such a diff with the RBTools post command.

Say, for example, your Subversion repository is registered with following URL at review board:

http://svn.example.org/foo/base/group

(where foo is noise and base is the base of your repository)

Then let's assume that we have two tags

http://svn.example.org/foo/base/group/module/tag/abc1
http://svn.example.org/foo/base/group/module/tag/abc2

where abc2 is based on abc1 and introduces some changes.

To create a review request for those changes, first, we make a diff with Subversion:

base=http://svn.example.org/foo/base/group
svn diff $base/module/tag/abc1 $base/module/tag/abc2 \
  > --patch-compatible > change_xyz.diff

We can post the diff with rbt post, but for that, we need a Subversion working directory. An empty one is sufficient:

svn co --depth=empty $base
cd group

The rbt command needs some configuration, to simplify things username/password can also be stored in a run control file, e.g.:

cat > .reviewboardrc <<EOF
REVIEWBOARD_URL = 'http://reviewboard.example.org/'
REPOSITORY = 'somerepo'
PASSWORD = 'einsfueralles'
USERNAME = 'juser'
EOF

When posting the diff the rbt resolves the relative paths in the diff file against the working directory, thus we have to add missing parts with the --basedir option:

rbt post --diff-filename ../change_xyz.diff --basedir module/tag

If everything works ok, rbt uploads the diff and the referenced files to a new draft and prints the new URLs, e.g.:

http://reviewboard.example.org/r/23/
http://reviewboard.example.org/r/23/diff/

The draft can then be edited and finally published via the web UI. The rbt post command also has several options to add additional data (e.g. --summary, --description) and/or directly publish it (cf. --publish).

maxschlepzig
  • 35,645
  • 14
  • 145
  • 182
  • I have already did what you tell above, but the problem resides in the URL preview in the review board I can see the URLs shown like that : [http://svn.example.org/foo/base/group/module/tag/abc1] that was for the first base part (right hand side in the diff preview) [http://svn.example.org/foo/base/abc2] as you can see the left hand sided URL in the diff preview doesn't have the full URL – Muhammad Yusuf May 03 '16 at 08:31
  • @MuhammadYusuf, as-is, my answer only works for SVN URLs where just the last component is different - as in `http://example.org/foo/tag/abc1` and `http://example.org/foo/tag/abc2` – maxschlepzig Jun 25 '16 at 14:12