tetra 0.48.0 → 0.49.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. data/README.md +1 -1
  2. data/SPECIAL_CASES.md +1 -1
  3. data/lib/template/{kit → bundled}/apache-ant-1.9.4/INSTALL +0 -0
  4. data/lib/template/{kit → bundled}/apache-ant-1.9.4/KEYS +0 -0
  5. data/lib/template/{kit → bundled}/apache-ant-1.9.4/LICENSE +0 -0
  6. data/lib/template/{kit → bundled}/apache-ant-1.9.4/NOTICE +0 -0
  7. data/lib/template/{kit → bundled}/apache-ant-1.9.4/README +0 -0
  8. data/lib/template/{kit → bundled}/apache-ant-1.9.4/WHATSNEW +0 -0
  9. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant +0 -0
  10. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant.bat +0 -0
  11. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant.cmd +0 -0
  12. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun +0 -0
  13. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun.bat +0 -0
  14. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun.pl +0 -0
  15. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antenv.cmd +0 -0
  16. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/complete-ant-cmd.pl +0 -0
  17. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/envset.cmd +0 -0
  18. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/lcp.bat +0 -0
  19. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runant.pl +0 -0
  20. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runant.py +0 -0
  21. data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runrc.cmd +0 -0
  22. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/ant-bootstrap.jar +0 -0
  23. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/changelog.xsl +0 -0
  24. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-frames.xsl +0 -0
  25. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-text.xsl +0 -0
  26. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-xdoc.xsl +0 -0
  27. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/coverage-frames.xsl +0 -0
  28. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/jdepend-frames.xsl +0 -0
  29. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/jdepend.xsl +0 -0
  30. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-frames-xalan1.xsl +0 -0
  31. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-frames.xsl +0 -0
  32. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-noframes.xsl +0 -0
  33. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/log.xsl +0 -0
  34. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/maudit-frames.xsl +0 -0
  35. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/mmetrics-frames.xsl +0 -0
  36. data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/tagdiff.xsl +0 -0
  37. data/lib/template/{kit → bundled}/apache-ant-1.9.4/fetch.xml +0 -0
  38. data/lib/template/{kit → bundled}/apache-ant-1.9.4/get-m2.xml +0 -0
  39. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/README +0 -0
  40. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-antlr.jar +0 -0
  41. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-antlr.pom +0 -0
  42. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bcel.jar +0 -0
  43. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bcel.pom +0 -0
  44. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bsf.jar +0 -0
  45. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bsf.pom +0 -0
  46. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-log4j.jar +0 -0
  47. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-log4j.pom +0 -0
  48. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-oro.jar +0 -0
  49. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-oro.pom +0 -0
  50. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-regexp.jar +0 -0
  51. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-regexp.pom +0 -0
  52. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-resolver.jar +0 -0
  53. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-resolver.pom +0 -0
  54. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-xalan2.jar +0 -0
  55. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-xalan2.pom +0 -0
  56. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-logging.jar +0 -0
  57. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-logging.pom +0 -0
  58. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-net.jar +0 -0
  59. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-net.pom +0 -0
  60. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jai.jar +0 -0
  61. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jai.pom +0 -0
  62. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-javamail.jar +0 -0
  63. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-javamail.pom +0 -0
  64. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jdepend.jar +0 -0
  65. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jdepend.pom +0 -0
  66. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jmf.jar +0 -0
  67. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jmf.pom +0 -0
  68. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jsch.jar +0 -0
  69. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jsch.pom +0 -0
  70. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit.jar +0 -0
  71. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit.pom +0 -0
  72. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit4.jar +0 -0
  73. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit4.pom +0 -0
  74. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-launcher.jar +0 -0
  75. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-launcher.pom +0 -0
  76. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-netrexx.jar +0 -0
  77. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-netrexx.pom +0 -0
  78. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-parent.pom +0 -0
  79. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-swing.jar +0 -0
  80. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-swing.pom +0 -0
  81. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-testutil.jar +0 -0
  82. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-testutil.pom +0 -0
  83. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant.jar +0 -0
  84. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant.pom +0 -0
  85. data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/libraries.properties +0 -0
  86. data/lib/template/{kit → bundled}/apache-maven-3.2.5/LICENSE +0 -0
  87. data/lib/template/{kit → bundled}/apache-maven-3.2.5/NOTICE +0 -0
  88. data/lib/template/{kit → bundled}/apache-maven-3.2.5/README.txt +0 -0
  89. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/m2.conf +0 -0
  90. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvn +0 -0
  91. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvn.bat +0 -0
  92. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnDebug +0 -0
  93. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnDebug.bat +0 -0
  94. data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnyjp +0 -0
  95. data/lib/template/{kit → bundled}/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar +0 -0
  96. data/lib/template/{kit → bundled}/apache-maven-3.2.5/conf/logging/simplelogger.properties +0 -0
  97. data/lib/template/{kit → bundled}/apache-maven-3.2.5/conf/settings.xml +0 -0
  98. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-api-1.0.0.v20140518.jar +0 -0
  99. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-api.license +0 -0
  100. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-connector-basic-1.0.0.v20140518.jar +0 -0
  101. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-connector-basic.license +0 -0
  102. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-impl-1.0.0.v20140518.jar +0 -0
  103. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-impl.license +0 -0
  104. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-spi-1.0.0.v20140518.jar +0 -0
  105. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-spi.license +0 -0
  106. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-transport-wagon-1.0.0.v20140518.jar +0 -0
  107. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-transport-wagon.license +0 -0
  108. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-util-1.0.0.v20140518.jar +0 -0
  109. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-util.license +0 -0
  110. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aopalliance-1.0.jar +0 -0
  111. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/cdi-api-1.0.jar +0 -0
  112. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/cdi-api.license +0 -0
  113. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-cli-1.2.jar +0 -0
  114. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-io-2.2.jar +0 -0
  115. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-lang-2.6.jar +0 -0
  116. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/ext/README.txt +0 -0
  117. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/guava-18.0.jar +0 -0
  118. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/javax.inject-1.jar +0 -0
  119. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsoup-1.7.2.jar +0 -0
  120. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsoup.license +0 -0
  121. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsr250-api-1.0.jar +0 -0
  122. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsr250-api.license +0 -0
  123. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-aether-provider-3.2.5.jar +0 -0
  124. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-aether-provider.license +0 -0
  125. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-artifact-3.2.5.jar +0 -0
  126. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-artifact.license +0 -0
  127. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-compat-3.2.5.jar +0 -0
  128. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-compat.license +0 -0
  129. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-core-3.2.5.jar +0 -0
  130. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-core.license +0 -0
  131. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-embedder-3.2.5.jar +0 -0
  132. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-embedder.license +0 -0
  133. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-3.2.5.jar +0 -0
  134. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-builder-3.2.5.jar +0 -0
  135. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-builder.license +0 -0
  136. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model.license +0 -0
  137. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-plugin-api-3.2.5.jar +0 -0
  138. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-plugin-api.license +0 -0
  139. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-repository-metadata-3.2.5.jar +0 -0
  140. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-repository-metadata.license +0 -0
  141. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-3.2.5.jar +0 -0
  142. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-builder-3.2.5.jar +0 -0
  143. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-builder.license +0 -0
  144. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings.license +0 -0
  145. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.inject-0.3.0.M1.jar +0 -0
  146. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.inject.license +0 -0
  147. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar +0 -0
  148. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus.license +0 -0
  149. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-cipher-1.7.jar +0 -0
  150. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-cipher.license +0 -0
  151. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-component-annotations-1.5.5.jar +0 -0
  152. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-interpolation-1.21.jar +0 -0
  153. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-sec-dispatcher-1.3.jar +0 -0
  154. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-sec-dispatcher.license +0 -0
  155. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-utils-3.0.20.jar +0 -0
  156. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/sisu-guice-3.2.3-no_aop.jar +0 -0
  157. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-api-1.7.5.jar +0 -0
  158. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-api.license +0 -0
  159. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-simple-1.7.5.jar +0 -0
  160. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-simple.license +0 -0
  161. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-file-2.8.jar +0 -0
  162. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-file.license +0 -0
  163. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-2.8-shaded.jar +0 -0
  164. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-shared-2.8.jar +0 -0
  165. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-shared.license +0 -0
  166. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http.license +0 -0
  167. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-provider-api-2.8.jar +0 -0
  168. data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-provider-api.license +0 -0
  169. data/lib/tetra/facades/git.rb +59 -70
  170. data/lib/tetra/facades/process_runner.rb +10 -9
  171. data/lib/tetra/packages/kit_package.rb +1 -2
  172. data/lib/tetra/packages/package.rb +1 -1
  173. data/lib/tetra/packages/scriptable.rb +1 -1
  174. data/lib/tetra/packages/speccable.rb +1 -1
  175. data/lib/tetra/pom.rb +5 -1
  176. data/lib/tetra/project.rb +64 -65
  177. data/lib/tetra/version.rb +1 -1
  178. data/spec/lib/built_package_spec.rb +1 -1
  179. data/spec/lib/git_spec.rb +23 -28
  180. data/spec/lib/project_spec.rb +30 -12
  181. data/spec/lib/scriptable_spec.rb +1 -1
  182. data/spec/spec_helper.rb +1 -1
  183. metadata +168 -168
data/README.md CHANGED
@@ -93,7 +93,7 @@ and cloned with:
93
93
 
94
94
  Are you using `tetra` or even just reading this? Let's get in touch!
95
95
 
96
- smoioli at suse dot de
96
+ moio at suse dot de
97
97
 
98
98
  ## License
99
99
 
@@ -41,7 +41,7 @@ Note that the kit packages is only needed at build time by OBS, no end user shou
41
41
 
42
42
  ## Gotchas
43
43
 
44
- * `tetra` internally uses `git` to keep track of files, any tetra project is actually also a `git` repo. Feel free to navigate it, you can commit, push and pull as long as the `tetra` tags are preserved. You can also delete commits and tags, effectively rewinding tetra history (just make sure to delete all tags pointing to a certain commit when you discard it);
44
+ * `tetra` internally uses `git` to keep track of files, any tetra project is actually also a `git` repo. Feel free to use it as any ordinary git repo, including pushing to a remote repo, rebasing, merging or using GitHub's pull requests. Just make sure any `tetra: ` comments are preserved;
45
45
  * some Maven plugins like the Eclipse Project ones ([Tycho](https://www.eclipse.org/tycho/)) will save data in `/tmp` downloaded from the Internet and will produce errors if this data is not there during offline builds. One way to work around that is to force Java to use a kit subdirectory as `/tmp`. Add the following option to `tetra mvn` during your build:
46
46
 
47
47
  -Djava.io.tmpdir=<full path to project>/kit/tmp
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Tetra
4
4
  # facade to git, currently implemented with calls to the git command
5
- # prefixes all tags with "tetra_"
6
5
  class Git
7
6
  include Logging
8
7
  include ProcessRunner
@@ -24,87 +23,72 @@ module Tetra
24
23
  end
25
24
  end
26
25
 
27
- # returns a list of filenames that changed in the repo
28
- # since the specified tag
29
- def changed_files_since(tag)
30
- changed_files_between(tag, nil, ".")
26
+ # returns the id of the most recent commit
27
+ # that has the specified comment prefix in its message
28
+ # returns nil if such commit does not exist
29
+ def latest_id(comment_prefix)
30
+ Dir.chdir(@directory) do
31
+ result = run("git rev-list --max-count=1 --grep=\"#{comment_prefix}\" --fixed-strings HEAD")
32
+ result.strip if result != ""
33
+ end
34
+ end
35
+
36
+ # returns the comment of the most recent commit
37
+ # that has the specified comment prefix in its message
38
+ # returns nil if such commit does not exist
39
+ def latest_comment(comment_prefix)
40
+ Dir.chdir(@directory) do
41
+ id = latest_id(comment_prefix)
42
+ run("git rev-list --max-count=1 --format=%B #{id}") unless id.nil?
43
+ end
31
44
  end
32
45
 
33
46
  # returns a list of filenames that changed in the repo
34
- # between specified tags, in a certain directory
35
- def changed_files_between(start_tag, end_tag, directory)
47
+ # between specified ids, in a certain directory
48
+ def changed_files_between(start_id, end_id, directory)
36
49
  Dir.chdir(@directory) do
37
- prefixed_start_tag = "tetra_#{start_tag}"
38
- prefixed_end_tag = (
39
- if end_tag
40
- "tetra_#{end_tag}"
41
- else
42
- "HEAD"
43
- end
44
- )
45
50
  run("git diff-tree \
46
51
  --no-commit-id \
47
52
  --name-only \
48
- -r #{prefixed_start_tag} #{prefixed_end_tag}\
53
+ -r #{start_id} #{end_id}\
49
54
  -- #{directory}"
50
55
  ).split("\n")
51
56
  end
52
57
  end
53
58
 
54
- # adds all files in the current directory, removes
55
- # all files not in the current directory, commits
56
- # and tags with prefix
57
- def commit_whole_directory(message, tag, tag_message = nil)
59
+ # adds all files in the current directory,
60
+ # removes all files not in the current directory,
61
+ # commits with message
62
+ def commit_whole_directory(message)
58
63
  Dir.chdir(@directory) do
59
64
  log.debug "committing with message: #{message}"
60
65
 
61
66
  run("git rm -r --cached --ignore-unmatch .")
62
67
  run("git add .")
63
- run("git commit -m \"#{message}\"", false, false)
64
-
65
- if !tag_message.nil?
66
- run("git tag tetra_#{tag} -m \"#{tag_message}\"")
67
- else
68
- run("git tag tetra_#{tag}")
69
- end
68
+ run("git commit --allow-empty -m \"#{message}\"")
70
69
  end
71
70
  end
72
71
 
73
- # commits and tags one single file
74
- # if tag is given, commit is also tagged
75
- def commit_file(path, message, tag)
72
+ # commits one single file
73
+ def commit_file(path, message)
76
74
  Dir.chdir(@directory) do
77
75
  log.debug "committing path #{path} with message: #{message}"
78
76
  run("git add #{path}")
79
- run("git commit -m \"#{message}\"", false, false)
80
- run("git tag tetra_#{tag}")
77
+ run("git commit --allow-empty -m \"#{message}\"")
81
78
  end
82
79
  end
83
80
 
84
- # returns the highest suffix found in tags with the given prefix
85
- def get_tag_maximum_suffix(prefix)
86
- Dir.chdir(@directory) do
87
- run("git tag").split.map do |tag|
88
- if tag =~ /^tetra_#{prefix}_([0-9]+)$/
89
- Regexp.last_match[1].to_i
90
- else
91
- 0
92
- end
93
- end.max || 0
94
- end
95
- end
96
-
97
- # reverts path contents as per specified tag
98
- def revert_whole_directory(path, tag)
81
+ # reverts path contents as per specified id
82
+ def revert_whole_directory(path, id)
99
83
  Dir.chdir(@directory) do
100
84
  # reverts added and modified files, both in index and working tree
101
- run("git checkout -f tetra_#{tag} -- #{path}")
85
+ run("git checkout -f #{id} -- #{path}")
102
86
 
103
87
  # compute the list of deleted files
104
- files_in_tag = run("git ls-tree --name-only -r tetra_#{tag} -- #{path}").split("\n")
88
+ files_in_commit = run("git ls-tree --name-only -r #{id} -- #{path}").split("\n")
105
89
  files_in_head = run("git ls-tree --name-only -r HEAD -- #{path}").split("\n")
106
90
  files_added_after_head = run("git ls-files -o -- #{path}").split("\n")
107
- files_to_delete = files_in_head - files_in_tag + files_added_after_head
91
+ files_to_delete = files_in_head - files_in_commit + files_added_after_head
108
92
 
109
93
  files_to_delete.each do |file|
110
94
  FileUtils.rm_rf(file)
@@ -112,33 +96,38 @@ module Tetra
112
96
  end
113
97
  end
114
98
 
115
- # 3-way merges the git file at path with the one in new_path
116
- # assuming they have a common ancestor at the specified tag
117
- # returns the conflict count
118
- def merge_with_tag(path, new_path, tag)
99
+ # reverts the whole repo to the last commit while
100
+ # leaving changes in the working directory
101
+ def undo_last_commit
119
102
  Dir.chdir(@directory) do
120
- run("git show tetra_#{tag}:#{path} > #{path}.old_version")
121
- run("git merge-file #{path} #{path}.old_version #{new_path} \
122
- -L \"newly generated\" \
123
- -L \"previously generated\" \
124
- -L \"user edited\"")
125
- conflict_count = $CHILD_STATUS.exitstatus
126
- File.delete("#{path}.old_version")
127
- return conflict_count
103
+ run("git reset HEAD~")
128
104
  end
129
105
  end
130
106
 
131
- # deletes a tag
132
- def delete_tag(tag)
107
+ # 3-way merges the git file at path with the one in new_path
108
+ # assuming they have a common ancestor at the specified id
109
+ # returns the conflict count
110
+ def merge_with_id(path, new_path, id)
133
111
  Dir.chdir(@directory) do
134
- run("git tag -d tetra_#{tag}")
112
+ run("git show #{id}:#{path} > #{path}.old_version")
113
+
114
+ conflict_count = 0
115
+ begin
116
+ run("git merge-file #{path} #{path}.old_version #{new_path} \
117
+ -L \"newly generated\" \
118
+ -L \"previously generated\" \
119
+ -L \"user edited\"")
120
+ rescue ExecutionFailed => e
121
+ if e.status > 0
122
+ conflict_count = e.status
123
+ else
124
+ raise e
125
+ end
126
+ end
127
+ File.delete("#{path}.old_version")
128
+ conflict_count
135
129
  end
136
130
  end
137
-
138
- # returns the tag message
139
- def get_message(tag)
140
- run("git cat-file tag tetra_#{tag}").split.last
141
- end
142
131
  end
143
132
 
144
133
  class GitAlreadyInitedError < StandardError