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.

49 lines
1.3 KiB

8 years ago
  1. ################################################################################
  2. #
  3. # This file provides a basic wrapper to use git directly from the tcl console in
  4. # Vivado.
  5. # It requires the write_project_tcl_git.tcl script to work properly.
  6. # Unversioned files will be put in the work/ folder
  7. #
  8. # Ricardo Barbedo
  9. #
  10. ################################################################################
  11. namespace eval ::git_wrapper {
  12. namespace export git
  13. namespace import ::custom::write_project_tcl_git
  14. namespace import ::current_project
  15. namespace import ::common::get_property
  16. proc git {args} {
  17. set command [lindex $args 0]
  18. switch $command {
  19. "init" {git_init {*}$args}
  20. "commit" {git_commit {*}$args}
  21. "default" {exec git {*}$args}
  22. }
  23. }
  24. proc git_init {args} {
  25. # Generate gitignore file
  26. set file [open ".gitignore" "w"]
  27. puts $file "work/*"
  28. close $file
  29. # Initialize the repo
  30. exec git {*}$args
  31. }
  32. proc git_commit {args} {
  33. # Get project name
  34. set proj_file [current_project].tcl
  35. # Generate project and add it
  36. write_project_tcl_git -no_copy_sources -force $proj_file
  37. puts $proj_file
  38. exec git add $proj_file
  39. # Now commit everything
  40. exec git {*}$args
  41. }
  42. }