~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-26 15:39:04 UTC
  • mfrom: (2456.2.6 rename_iter_changes_109993)
  • Revision ID: pqm@pqm.ubuntu.com-20070426153904-l91p9ybsqpxt2vyv
(John Arbash Meinel) Fix bug #109993 by fixing _iter_changes to not sync an on-disk file with an 'absent' dirblock record.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    option,
45
45
    osutils,
46
46
    trace,
47
 
    win32utils,
48
47
    )
49
48
""")
50
49
 
241
240
        if self.__doc__ == Command.__doc__:
242
241
            warn("No help message set for %r" % self)
243
242
 
244
 
    def _maybe_expand_globs(self, file_list):
245
 
        """Glob expand file_list if the platform does not do that itself.
246
 
        
247
 
        :return: A possibly empty list of unicode paths.
248
 
 
249
 
        Introduced in bzrlib 0.18.
250
 
        """
251
 
        if not file_list:
252
 
            file_list = []
253
 
        if sys.platform == 'win32':
254
 
            file_list = win32utils.glob_expand(file_list)
255
 
        return list(file_list)
256
 
 
257
243
    def _usage(self):
258
244
        """Return single-line grammar for this command.
259
245
 
288
274
        result += 'usage: %s\n' % self._usage()
289
275
 
290
276
        if self.aliases:
291
 
            result += 'aliases: '
 
277
            result += 'aliases:\n'
292
278
            result += ', '.join(self.aliases) + '\n'
293
279
 
294
280
        result += '\n'
332
318
 
333
319
        Maps from long option name to option object."""
334
320
        r = dict()
335
 
        r['help'] = option._help_option
 
321
        r['help'] = option.Option.OPTIONS['help']
336
322
        for o in self.takes_options:
337
323
            if isinstance(o, basestring):
338
324
                o = option.Option.OPTIONS[o]
548
534
 
549
535
def apply_lsprofiled(filename, the_callable, *args, **kwargs):
550
536
    from bzrlib.lsprof import profile
 
537
    import cPickle
551
538
    ret, stats = profile(the_callable, *args, **kwargs)
552
539
    stats.sort()
553
540
    if filename is None:
554
541
        stats.pprint()
555
542
    else:
556
 
        stats.save(filename)
557
 
        trace.note('Profile data written to "%s".', filename)
 
543
        stats.freeze()
 
544
        cPickle.dump(stats, open(filename, 'w'), 2)
 
545
        print 'Profile data written to %r.' % filename
558
546
    return ret
559
547
 
560
548
 
726
714
 
727
715
def run_bzr_catch_errors(argv):
728
716
    try:
729
 
        return run_bzr(argv)
 
717
        try:
 
718
            return run_bzr(argv)
 
719
        finally:
 
720
            # do this here inside the exception wrappers to catch EPIPE
 
721
            sys.stdout.flush()
730
722
    except (KeyboardInterrupt, Exception), e:
731
723
        # used to handle AssertionError and KeyboardInterrupt
732
724
        # specially here, but hopefully they're handled ok by the logger now