~ltrager/maas/lp1654432_2.1

« back to all changes in this revision

Viewing changes to utilities/format-new-and-modified-imports

  • Committer: Gavin Panella
  • Date: 2012-01-18 21:15:50 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: gavin.panella@canonical.com-20120118211550-surn0g3wes9ktw6f
Borrow format-imports from Launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
#
 
3
# Reformat imports in new and modified files. Call without arguments
 
4
# to operate on uncommitted changes. Arguments will be passed to bzr
 
5
# status, so to operate on all new and modified files relative to the
 
6
# submit branch, use:
 
7
#
 
8
#   format-new-and-modified-imports -r submit:
 
9
#
 
10
 
 
11
bzr status --short "$@" | \
 
12
    awk '/^.[MN] .*[.]py$/ { print $NF }' | \
 
13
    xargs -r "$(dirname "$0")/format-imports"