Commits

mdelagra  committed c4b32e7

adding test for using the outgoing flag when there are commits on multiple branches

  • Participants
  • Parent commits 4731505

Comments (0)

Files changed (5)

File mercurial_reviewboard/tests/diffs/outgoing_with_branch

+diff -r 669e757d4a24 -r 95a4170d2821 c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/c	Wed Nov 18 14:34:27 2009 -0600
+@@ -0,0 +1,1 @@
++c

File mercurial_reviewboard/tests/repo_tars/two_revs_clone.tar

Binary file added.

File mercurial_reviewboard/tests/scripts/create_diff_outgoing_with_branch

+pushd ../repos/two_revs_clone
+
+hg diff -r 1 -r 2 > ../../diffs/outgoing_with_branch

File mercurial_reviewboard/tests/scripts/create_repo_two_revs_clone

+pushd ../repo_tars
+
+tar xvf two_revs.tar
+
+hg clone two_revs/ two_revs_clone
+
+pushd two_revs_clone
+
+# add revisions for testing the -g flag
+
+echo c > c
+hg add
+hg commit -m 2 -u "john doe"
+
+hg up 0
+echo d > d
+hg add
+hg commit -m 3 -u "john doe"
+
+popd
+
+tar cvf two_revs_clone.tar two_revs_clone/
+
+rm -rf two_revs/
+rm -rf two_revs_clone/
+

File mercurial_reviewboard/tests/test_outgoing.py

     postreview(ui, repo, **opts)
     
     expected = open('mercurial_reviewboard/tests/diffs/outgoing', 'r').read()
+    eq_(expected, mock_send.call_args[0][4])
+    
+@patch('mercurial_reviewboard.send_review')
+def test_outgoing_with_branch(mock_send):
+    '''Test that only one change is included, despite a commit to another 
+    branch.'''
+    ui = mock_ui()
+    repo = get_repo(ui, 'two_revs_clone')
+    opts = get_initial_opts()
+    opts['outgoingrepo'] = 'mercurial_reviewboard/tests/repos/two_revs'
+    opts['outgoingchanges'] = True
+    postreview(ui, repo, '2', **opts)
+    
+    expected = open('mercurial_reviewboard/tests/diffs/outgoing_with_branch', 
+                    'r').read()
     eq_(expected, mock_send.call_args[0][4])