/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_grep.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
from __future__ import absolute_import
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
16
 
19
17
import os
20
18
import re
21
19
import unicodedata as ud
22
20
 
23
 
from ... import tests, osutils
24
 
from ...sixish import PY3
25
 
from ..._termcolor import color_string, FG
 
21
from .. import tests, osutils
 
22
from .._termcolor import color_string, FG
26
23
 
27
 
from ...tests.features import (
 
24
from ..tests.features import (
28
25
    UnicodeFilenameFeature,
29
26
    )
30
27
 
390
387
 
391
388
        out, err = self.run_bzr(
392
389
            ['grep', '-r', 'last:1', '--null', 'line[1-3]'])
393
 
        if not PY3:
394
 
            out = out.decode('utf-8', 'ignore')
395
390
        nout = ud.normalize(u'NFC', out)
396
391
        self.assertEqual(nout, nref)
397
392
        self.assertEqual(len(out.splitlines()), 1)
398
393
 
399
394
        out, err = self.run_bzr(['grep', '-r', 'last:1', '-Z', 'line[1-3]'])
400
 
        if not PY3:
401
 
            out = out.decode('utf-8', 'ignore')
402
395
        nout = ud.normalize(u'NFC', out)
403
396
        self.assertEqual(nout, nref)
404
397
        self.assertEqual(len(out.splitlines()), 1)
405
398
 
406
399
        out, err = self.run_bzr(['grep', '-r', 'last:1', '--null', 'line'])
407
 
        if not PY3:
408
 
            out = out.decode('utf-8', 'ignore')
409
400
        nout = ud.normalize(u'NFC', out)
410
401
        self.assertEqual(nout, nref)
411
402
        self.assertEqual(len(out.splitlines()), 1)
2429
2420
        self.assertEqualDiff(subst_dates(out), '''\
2430
2421
=== revno:3 ===
2431
2422
  === modified file 'hello'
2432
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2433
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2423
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2424
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2434
2425
    +hello world!
2435
2426
=== revno:1 ===
2436
2427
  === added file 'hello'
2437
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2438
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2428
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2429
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2439
2430
''')
2440
2431
 
2441
2432
    def test_grep_diff_revision(self):
2448
2439
        self.assertEqualDiff(subst_dates(out), '''\
2449
2440
=== revno:3 ===
2450
2441
  === modified file 'hello'
2451
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2452
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2442
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2443
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2453
2444
    +hello world!
2454
2445
''')
2455
2446
 
2470
2461
        self.assertEqualDiff(subst_dates(out), '''\
2471
2462
=== revno:5 ===
2472
2463
  === modified file 'hello'
2473
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2474
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2464
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2465
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2475
2466
    +hello world!3
2476
2467
=== revno:4 ===
2477
2468
  === added file 'blah'
2478
2469
    +hello world!2
2479
2470
=== revno:3 ===
2480
2471
  === modified file 'hello'
2481
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2482
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2472
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2473
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2483
2474
    +hello world!1
2484
2475
''')
2485
2476
 
2496
2487
            "  === modified file 'hello'", fg=FG.BOLD_MAGENTA) + '\n'
2497
2488
        redhello = color_string('hello', fg=FG.BOLD_RED)
2498
2489
        diffstr = '''\
2499
 
    --- hello   YYYY-MM-DD HH:MM:SS +ZZZZ
2500
 
    +++ hello   YYYY-MM-DD HH:MM:SS +ZZZZ
 
2490
    --- hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
2491
    +++ hello\tYYYY-MM-DD HH:MM:SS +ZZZZ
2501
2492
    +hello world!
2502
2493
'''
2503
2494
        diffstr = diffstr.replace('hello', redhello)