~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-06-05 18:04:33 UTC
  • mfrom: (3251.6.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080605180433-we1wgljieaz5g31l
(Adrian Wilkins) add --null to added and modified and path quoting

Show diffs side-by-side

added added

removed removed

Lines of Context:
1585
1585
 
1586
1586
    hidden = True
1587
1587
    _see_also = ['status', 'ls']
 
1588
    takes_options = [
 
1589
            Option('null',
 
1590
                   help='Write an ascii NUL (\\0) separator '
 
1591
                   'between files rather than a newline.')
 
1592
            ]
1588
1593
 
1589
1594
    @display_command
1590
 
    def run(self):
 
1595
    def run(self, null=False):
1591
1596
        tree = WorkingTree.open_containing(u'.')[0]
1592
1597
        td = tree.changes_from(tree.basis_tree())
1593
1598
        for path, id, kind, text_modified, meta_modified in td.modified:
1594
 
            self.outf.write(path + '\n')
 
1599
            if null:
 
1600
                self.outf.write(path + '\0')
 
1601
            else:
 
1602
                self.outf.write(osutils.quotefn(path) + '\n')
1595
1603
 
1596
1604
 
1597
1605
class cmd_added(Command):
1600
1608
 
1601
1609
    hidden = True
1602
1610
    _see_also = ['status', 'ls']
 
1611
    takes_options = [
 
1612
            Option('null',
 
1613
                   help='Write an ascii NUL (\\0) separator '
 
1614
                   'between files rather than a newline.')
 
1615
            ]
1603
1616
 
1604
1617
    @display_command
1605
 
    def run(self):
 
1618
    def run(self, null=False):
1606
1619
        wt = WorkingTree.open_containing(u'.')[0]
1607
1620
        wt.lock_read()
1608
1621
        try:
1619
1632
                    path = inv.id2path(file_id)
1620
1633
                    if not os.access(osutils.abspath(path), os.F_OK):
1621
1634
                        continue
1622
 
                    self.outf.write(path + '\n')
 
1635
                    if null:
 
1636
                        self.outf.write(path + '\0')
 
1637
                    else:
 
1638
                        self.outf.write(osutils.quotefn(path) + '\n')
1623
1639
            finally:
1624
1640
                basis.unlock()
1625
1641
        finally: