You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wnf.py 1.5 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. import os, sys
  3. from py.build import version
  4. version.verbose = True
  5. def run():
  6. sys.path.append('lib')
  7. sys.path.append('lib/py')
  8. if len(sys.argv)<2:
  9. print "wnframework version control utility"
  10. print
  11. print "Usage: wnf build|add|commit|diff|merge|setup"
  12. cmd = sys.argv[1]
  13. if cmd=='build':
  14. from py import build
  15. build.run()
  16. vc = version.VersionControl()
  17. print 'version %s' % vc.repo.get_value('last_version_number')
  18. if cmd=='merge':
  19. vc = version.VersionControl()
  20. vc.setup_master()
  21. if sys.argv[2]=='local':
  22. vc.merge(vc.repo, vc.master)
  23. elif sys.argv[2]=='master':
  24. vc.merge(vc.master, vc.repo)
  25. else:
  26. print "usage: wnf merge local|master"
  27. print "help: parameter (local or master) is the source"
  28. vc.close()
  29. if cmd=='setup':
  30. vc = version.VersionControl()
  31. vc.repo.setup()
  32. vc.close()
  33. if cmd=='clear_startup':
  34. from webnotes import startup
  35. startup.clear_info('all')
  36. vc = version.VersionControl()
  37. print 'version %s' % vc.repo.get_value('last_version_number')
  38. if cmd=='log':
  39. vc = version.VersionControl()
  40. for l in vc.repo.sql("select * from log order by rowid desc limit 10 ", as_dict =1):
  41. print 'file:'+ l['fname'] + ' | version: ' + l['version']
  42. print 'version %s' % vc.repo.get_value('last_version_number')
  43. vc.close()
  44. if cmd=='files':
  45. vc = version.VersionControl()
  46. for f in vc.repo.sql("select fname from files where fname like ?", ((sys.argv[2] + '%'),)):
  47. print f[0]
  48. vc.close()
  49. if __name__=='__main__':
  50. run()