Support the R1:R2 syntax for git

Review Request #5209 — Created Jan. 7, 2014 and submitted

Information

RBTools
master

Reviewers

Support the R1:R2 syntax for git

Added a test case similar to the one for SVN.

Ran nosetests, all tests pass aside from Mercrial ones which are unrelated to this change:

[mhahn@mhahn-02344:rbtools(master)]$ nosetests
...................SSSSSSSSSSSSSSS...................SSSSSSSSSSSSEEEEEEEE.................................
======================================================================
ERROR: Testing MercurialClient (+svn) _calculate_hgsubversion_repository_info properly determines repository and base paths.


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) diff specifying a revision.


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) diff, simple case


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) diff with multiple commits


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) get_repository_info, simple case


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) scan_for_server in svn property


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) scan_for_server in .reviewboardrc


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Testing MercurialClient (+svn) scan_for_server, simple case


Traceback (most recent call last):
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 697, in setUp
if not self._has_hgsubversion():
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 719, in _has_hgsubversion
ignore_errors=True, extra_ignore_errors=(255))
File "/Users/mhahn/open_source/rbtools/rbtools/clients/tests.py", line 441, in _run_hg
translate_newlines=True)
File "/Users/mhahn/open_source/rbtools/rbtools/utils/process.py", line 67, in execute
env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
-------------------- >> begin captured logging << --------------------
root: DEBUG: Running: hg svn --help
--------------------- >> end captured logging << ---------------------


Ran 106 tests in 11.163s

FAILED (SKIP=27, errors=8)

david
  1. I'm going to push this fix to the release-0.5.x branch only, and we'll put out a release soon.

    On the 'master' branch, we're working on a big change to clean up our treatment of revisions and files across all VCS backends: https://reviewboard.hackpad.com/RBTools-Diff-Behavior-gRwNAvl3SzJ

    As part of this work, we're transitioning away from the global R1:R2 syntax to using native syntax for revisions. This means that instead of doing:

    rbt post --revision-range=R1:R2

    you would do:

    rbt post R1..R2

    This has the side benefit of supporting other, more complex syntaxes like R1~3...master

    1. Sounds good. I would make sure that "guess-description" and "guess-summary" work properly. They're directly tied to the R1:R2 syntax and is what prompted me to push this fix.

  2. 
      
MH
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.5.x (fac8683). Thanks!