File: check-modified.py

package info (click to toggle)
subversion 1.4.2dfsg1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,268 kB
  • ctags: 32,888
  • sloc: ansic: 406,472; python: 38,378; sh: 15,248; cpp: 9,604; ruby: 8,313; perl: 5,308; java: 4,576; lisp: 3,860; xml: 3,298; makefile: 856
file content (45 lines) | stat: -rwxr-xr-x 883 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
#
# USAGE: check-modified.py FILE_OR_DIR1 FILE_OR_DIR2 ...
#
# prints out the URL associated with each item
#

import sys
import os
import os.path
import svn.core
import svn.client
import svn.wc

FORCE_COMPARISON = 0

def usage():
  print "Usage: " + sys.argv[0] + " FILE_OR_DIR1 FILE_OR_DIR2\n"
  sys.exit(0)

def run(files):

  for f in files:
    dirpath = fullpath = os.path.abspath(f)
    if not os.path.isdir(dirpath):
      dirpath = os.path.dirname(dirpath)
  
    adm_baton = svn.wc.adm_open(None, dirpath, False, True)

    try:
      entry = svn.wc.entry(fullpath, adm_baton, 0)

      if svn.wc.text_modified_p(fullpath, FORCE_COMPARISON,
				adm_baton):
        print "M      %s" % f
      else:
        print "       %s" % f
    except:
      print "?      %s" % f

    svn.wc.adm_close(adm_baton)

if __name__ == '__main__':
  run(sys.argv[1:])