Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0105ECBF for ; Mon, 21 Jan 2013 20:28:17 +0000 (UTC) Received: (qmail 27983 invoked by uid 500); 21 Jan 2013 20:28:17 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 27959 invoked by uid 500); 21 Jan 2013 20:28:17 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 27952 invoked by uid 99); 21 Jan 2013 20:28:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 20:28:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 20:28:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B397123888D2; Mon, 21 Jan 2013 20:27:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1436592 - in /subversion/trunk/subversion: svn/notify.c tests/cmdline/patch_tests.py Date: Mon, 21 Jan 2013 20:27:55 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130121202755.B397123888D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhuijben Date: Mon Jan 21 20:27:55 2013 New Revision: 1436592 URL: http://svn.apache.org/viewvc?rev=1436592&view=rev Log: Update the expectations of the issue #3644 test, to assume the patch is applied ok. Verify the final result. * subversion/svn/notify.c (notify): Don't show an offset when patching the empty file. * subversion/tests/cmdline/patch_tests.py (patch_empty_file): Remove XFail marker. Expect applied hunk. Verify disk. Modified: subversion/trunk/subversion/svn/notify.c subversion/trunk/subversion/tests/cmdline/patch_tests.py Modified: subversion/trunk/subversion/svn/notify.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1436592&r1=1436591&r2=1436592&view=diff ============================================================================== --- subversion/trunk/subversion/svn/notify.c (original) +++ subversion/trunk/subversion/svn/notify.c Mon Jan 21 20:27:55 2013 @@ -348,6 +348,11 @@ notify(void *baton, const svn_wc_notify_ { off = n->hunk_matched_line - n->hunk_original_start; minus = ""; + + /* If we are patching from the start of an empty file, + it is nicer to show offset 0 */ + if (n->hunk_original_start == 0 && n->hunk_matched_line == 1) + off = 0; /* No offset, just adding */ } else { Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1436592&r1=1436591&r2=1436592&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Mon Jan 21 20:27:55 2013 @@ -4396,7 +4396,6 @@ def single_line_mismatch(sbox): 'patch', patch_file_path, wc_dir) @Issue(3644) -@XFail() def patch_empty_file(sbox): "apply a patch to an empty file" @@ -4439,12 +4438,24 @@ def patch_empty_file(sbox): 'U %s\n' % sbox.ospath('lf.txt'), 'A %s\n' % sbox.ospath('new.txt'), 'U %s\n' % sbox.ospath('empty.txt'), + # Not sure if this line is necessary, but it doesn't hurt + '> applied hunk @@ -0,0 +1,1 @@ with offset 0\n', ] # Current result: lf.txt patched ok, new created, empty succeeds with offset. svntest.actions.run_and_verify_svn(None, expected_output, [], 'patch', patch_file_path, wc_dir) + expected_disk = svntest.main.greek_state.copy() + expected_disk.add({ + 'lf.txt' : Item(contents="\n"), + 'new.txt' : Item(contents="new file\n"), + 'empty.txt' : Item(contents="replacement\n"), + }) + + svntest.actions.verify_disk(wc_dir, expected_disk) + + ######################################################################## #Run the tests