Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Mirroring hg changes. License notifications everywhere. Server code i…

…s working foreals. Making 'stats' an official extension. Tightening up code everywhere I can.
  • Loading branch information...
commit cd3a6a82f9e051629de06d90e99dc0ae35def370 1 parent 5aab78f
Michael Edgar authored
Showing with 3,395 additions and 378 deletions.
  1. +30 −2 LICENSE
  2. +13 −15 Rakefile
  3. +1 −17 ampfile.rb
  4. +16 −0 lib/amp.rb
  5. +14 −0 lib/amp/commands/command.rb
  6. +14 −0 lib/amp/commands/command_support.rb
  7. +14 −0 lib/amp/commands/commands/config.rb
  8. +14 −0 lib/amp/commands/commands/help.rb
  9. +14 −0 lib/amp/commands/commands/init.rb
  10. +14 −0 lib/amp/commands/commands/templates.rb
  11. +14 −0 lib/amp/commands/commands/version.rb
  12. +14 −0 lib/amp/commands/commands/workflow.rb
  13. +14 −0 lib/amp/commands/commands/workflows/git/add.rb
  14. +14 −0 lib/amp/commands/commands/workflows/git/copy.rb
  15. +14 −0 lib/amp/commands/commands/workflows/git/mv.rb
  16. +14 −0 lib/amp/commands/commands/workflows/git/rm.rb
  17. +18 −7 lib/amp/commands/commands/workflows/hg/add.rb
  18. +14 −0 lib/amp/commands/commands/workflows/hg/addremove.rb
  19. +16 −0 lib/amp/commands/commands/workflows/hg/annotate.rb
  20. +14 −0 lib/amp/commands/commands/workflows/hg/archive.rb
  21. +16 −40 lib/amp/commands/commands/workflows/hg/bisect.rb
  22. +14 −0 lib/amp/commands/commands/workflows/hg/branch.rb
  23. +16 −0 lib/amp/commands/commands/workflows/hg/branches.rb
  24. +16 −0 lib/amp/commands/commands/workflows/hg/bundle.rb
  25. +16 −0 lib/amp/commands/commands/workflows/hg/clone.rb
  26. +14 −0 lib/amp/commands/commands/workflows/hg/commit.rb
  27. +14 −0 lib/amp/commands/commands/workflows/hg/copy.rb
  28. +14 −0 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
  29. +14 −0 lib/amp/commands/commands/workflows/hg/debug/index.rb
  30. +14 −0 lib/amp/commands/commands/workflows/hg/default.rb
  31. +14 −0 lib/amp/commands/commands/workflows/hg/diff.rb
  32. +14 −0 lib/amp/commands/commands/workflows/hg/forget.rb
  33. +14 −0 lib/amp/commands/commands/workflows/hg/heads.rb
  34. +14 −0 lib/amp/commands/commands/workflows/hg/identify.rb
  35. +16 −0 lib/amp/commands/commands/workflows/hg/import.rb
  36. +16 −0 lib/amp/commands/commands/workflows/hg/incoming.rb
  37. +14 −0 lib/amp/commands/commands/workflows/hg/info.rb
  38. +14 −0 lib/amp/commands/commands/workflows/hg/log.rb
  39. +14 −0 lib/amp/commands/commands/workflows/hg/manifest.rb
  40. +16 −0 lib/amp/commands/commands/workflows/hg/merge.rb
  41. +14 −0 lib/amp/commands/commands/workflows/hg/move.rb
  42. +16 −0 lib/amp/commands/commands/workflows/hg/outgoing.rb
  43. +16 −0 lib/amp/commands/commands/workflows/hg/pull.rb
  44. +16 −0 lib/amp/commands/commands/workflows/hg/push.rb
  45. +16 −0 lib/amp/commands/commands/workflows/hg/remove.rb
  46. +14 −0 lib/amp/commands/commands/workflows/hg/resolve.rb
  47. +14 −0 lib/amp/commands/commands/workflows/hg/revert.rb
  48. +14 −0 lib/amp/commands/commands/workflows/hg/root.rb
  49. +14 −0 lib/amp/commands/commands/workflows/hg/serve.rb
  50. +14 −0 lib/amp/commands/commands/workflows/hg/status.rb
  51. +16 −0 lib/amp/commands/commands/workflows/hg/tag.rb
  52. +16 −0 lib/amp/commands/commands/workflows/hg/tags.rb
  53. +14 −0 lib/amp/commands/commands/workflows/hg/tip.rb
  54. +14 −0 lib/amp/commands/commands/workflows/hg/untrack.rb
  55. +14 −0 lib/amp/commands/commands/workflows/hg/update.rb
  56. +14 −0 lib/amp/commands/commands/workflows/hg/verify.rb
  57. +16 −0 lib/amp/commands/commands/workflows/hg/view.rb
  58. +14 −0 lib/amp/commands/commands/workflows/hg/what_changed.rb
  59. +14 −0 lib/amp/commands/dispatch.rb
  60. +14 −0 lib/amp/commands/hooks.rb
  61. +14 −0 lib/amp/dependencies/amp_support/ruby_amp_support.rb
  62. +240 −0 lib/amp/dependencies/highline_extensions.rb
  63. +14 −0 lib/amp/dependencies/python_config.rb
  64. +15 −0 lib/amp/encoding/base85.rb
  65. +16 −0 lib/amp/encoding/binary_diff.rb
  66. +18 −0 lib/amp/encoding/difflib.rb
  67. +14 −0 lib/amp/extensions/ditz.rb
  68. +14 −0 lib/amp/extensions/lighthouse.rb
  69. +79 −0 lib/amp/extensions/stats.rb
  70. +16 −0 lib/amp/graphs/ancestor.rb
  71. +16 −0 lib/amp/graphs/copies.rb
  72. +14 −0 lib/amp/help/help.rb
  73. +14 −0 lib/amp/profiling_hacks.rb
  74. +14 −0 lib/amp/repository/abstract/abstract_changeset.rb
  75. +14 −0 lib/amp/repository/abstract/abstract_local_repo.rb
  76. +14 −0 lib/amp/repository/abstract/abstract_staging_area.rb
  77. +14 −0 lib/amp/repository/abstract/abstract_versioned_file.rb
  78. +14 −0 lib/amp/repository/abstract/common_methods/changeset.rb
  79. +15 −1 lib/amp/repository/abstract/common_methods/local_repo.rb
  80. +14 −0 lib/amp/repository/abstract/common_methods/staging_area.rb
  81. +14 −0 lib/amp/repository/abstract/common_methods/versioned_file.rb
  82. +14 −0 lib/amp/repository/generic_repo_picker.rb
  83. +14 −0 lib/amp/repository/git/repo_format/changeset.rb
  84. +14 −0 lib/amp/repository/git/repo_format/staging_area.rb
  85. +14 −0 lib/amp/repository/git/repo_format/versioned_file.rb
  86. +14 −0 lib/amp/repository/git/repositories/local_repository.rb
  87. +14 −0 lib/amp/repository/git/repository.rb
  88. +16 −0 lib/amp/repository/mercurial/encoding/mercurial_diff.rb
  89. +15 −0 lib/amp/repository/mercurial/encoding/patch.rb
  90. +17 −1 lib/amp/repository/mercurial/encoding/pure_ruby/ruby_mercurial_patch.rb
  91. +16 −0 lib/amp/repository/mercurial/merging/merge_ui.rb
  92. +16 −0 lib/amp/repository/mercurial/merging/simple_merge.rb
  93. +14 −0 lib/amp/repository/mercurial/repo_format/branch_manager.rb
  94. +51 −30 lib/amp/repository/mercurial/repo_format/changeset.rb
  95. +16 −0 lib/amp/repository/mercurial/repo_format/dir_state.rb
  96. +16 −0 lib/amp/repository/mercurial/repo_format/journal.rb
  97. +16 −0 lib/amp/repository/mercurial/repo_format/lock.rb
  98. +16 −0 lib/amp/repository/mercurial/repo_format/merge_state.rb
  99. +16 −0 lib/amp/repository/mercurial/repo_format/staging_area.rb
  100. +16 −0 lib/amp/repository/mercurial/repo_format/store.rb
  101. +16 −0 lib/amp/repository/mercurial/repo_format/tag_manager.rb
  102. +16 −0 lib/amp/repository/mercurial/repo_format/updatable.rb
  103. +16 −0 lib/amp/repository/mercurial/repo_format/updater.rb
  104. +16 −0 lib/amp/repository/mercurial/repo_format/verification.rb
  105. +16 −0 lib/amp/repository/mercurial/repositories/bundle_repository.rb
  106. +16 −0 lib/amp/repository/mercurial/repositories/http_repository.rb
  107. +17 −5 lib/amp/repository/mercurial/repositories/local_repository.rb
  108. +14 −2 lib/amp/repository/mercurial/repository.rb
  109. +17 −1 lib/amp/repository/mercurial/revlogs/bundle_revlogs.rb
  110. +16 −0 lib/amp/repository/mercurial/revlogs/changegroup.rb
  111. +16 −0 lib/amp/repository/mercurial/revlogs/changelog.rb
  112. +16 −13 lib/amp/repository/mercurial/revlogs/file_log.rb
  113. +16 −0 lib/amp/repository/mercurial/revlogs/index.rb
  114. +16 −0 lib/amp/repository/mercurial/revlogs/manifest.rb
  115. +14 −0 lib/amp/repository/mercurial/revlogs/node.rb
  116. +16 −2 lib/amp/repository/mercurial/revlogs/revlog.rb
  117. +17 −1 lib/amp/repository/mercurial/revlogs/revlog_support.rb
  118. +16 −0 lib/amp/repository/mercurial/revlogs/versioned_file.rb
  119. +14 −0 lib/amp/repository/repository.rb
  120. +14 −0 lib/amp/server/amp_user.rb
  121. +45 −29 lib/amp/server/extension/amp_extension.rb
  122. +14 −0 lib/amp/server/extension/authorization.rb
  123. +179 −89 lib/amp/server/fancy_http_server.rb
  124. +18 −5 lib/amp/server/fancy_views/_browser.haml
  125. +0 −6 lib/amp/server/fancy_views/_diff_file.haml
  126. +14 −0 lib/amp/server/fancy_views/_navbar.haml
  127. +20 −1 lib/amp/server/fancy_views/changeset.haml
  128. +20 −10 lib/amp/server/fancy_views/commits.haml
  129. +18 −6 lib/amp/server/fancy_views/file.haml
  130. +22 −6 lib/amp/server/fancy_views/file_diff.haml
  131. +101 −67 lib/amp/server/fancy_views/stylesheet.sass
  132. +17 −4 lib/amp/server/http_server.rb
  133. +14 −0 lib/amp/support/amp_config.rb
  134. +14 −0 lib/amp/support/amp_ui.rb
  135. +14 −0 lib/amp/support/ampfile_config.rb
  136. +14 −0 lib/amp/support/docs.rb
  137. +14 −0 lib/amp/support/generator.rb
  138. +14 −0 lib/amp/support/loaders.rb
  139. +14 −0 lib/amp/support/logger.rb
  140. +16 −0 lib/amp/support/match.rb
  141. +14 −0 lib/amp/support/mercurial/ignore.rb
  142. +14 −0 lib/amp/support/multi_io.rb
  143. +14 −0 lib/amp/support/openers.rb
  144. +14 −0 lib/amp/support/ruby_19_compatibility.rb
  145. +40 −0 lib/amp/support/statistics.rb
  146. +25 −2 lib/amp/support/support.rb
  147. +29 −2 lib/amp/templates/template.rb
  148. +14 −0 spec/command_specs/command_helper.rb
  149. +14 −0 spec/command_specs/hg_workflow/addremove_spec.rb
  150. +14 −0 spec/command_specs/hg_workflow/copy_spec.rb
  151. +14 −0 spec/command_specs/hg_workflow/root_spec.rb
  152. +14 −0 spec/command_specs/hg_workflow/tip_spec.rb
  153. +14 −0 spec/command_specs/hg_workflow/update_spec.rb
  154. +14 −0 spec/command_specs/init_spec.rb
  155. +14 −0 spec/command_specs/version_spec.rb
  156. +14 −0 spec/spec_helper.rb
  157. +14 −0 tasks/man.rake
  158. +14 −0 tasks/stats.rake
  159. +14 −0 tasks/yard.rake
  160. +14 −0 test/changelog_tests/test_changelog.rb
  161. +14 −0 test/dirstate_tests/test_dir_state.rb
  162. +14 −0 test/filelog_tests/test_filelog.rb
  163. +14 −0 test/functional_tests/test_functional.rb
  164. +2 −12 test/localrepo_tests/ampfile.rb
  165. +14 −0 test/localrepo_tests/test_local_repo.rb
  166. +14 −0 test/manifest_tests/test_manifest.rb
  167. +14 −0 test/merge_tests/test_merge.rb
  168. +14 −0 test/revlog_tests/test_revlog.rb
  169. +14 −0 test/store_tests/test_fncache_store.rb
  170. +14 −0 test/test_19_compatibility.rb
  171. +14 −0 test/test_base85.rb
  172. +14 −0 test/test_bdiff.rb
  173. +14 −0 test/test_changegroup.rb
  174. +14 −0 test/test_commands.rb
  175. +14 −1 test/test_difflib.rb
  176. +14 −0 test/test_generator.rb
  177. +14 −0 test/test_ignore.rb
  178. +14 −0 test/test_journal.rb
  179. +14 −0 test/test_match.rb
  180. +14 −0 test/test_mdiff.rb
  181. +14 −0 test/test_mpatch.rb
  182. +14 −0 test/test_multi_io.rb
  183. +14 −0 test/test_support.rb
  184. +28 −1 test/test_templates.rb
  185. +14 −0 test/test_ui.rb
  186. +14 −0 test/testutilities.rb
View
32 LICENSE
@@ -1,10 +1,22 @@
+Amp is in a bit of limbo as it directs where its license will go. We want the code to fall under
+the Ruby license. However, we didn't think about that before we looked at the Mercurial source code.
+Mercurial (as noted below) is GPLv2+, and thus any code we derived from its codebase is also GPLv2. Any
+code which then interacts with, links against, calls, etc. that derived code is also considered GPLv2.
+
+So: each file is marked with a *standalone license*. If that code were to be extracted and treated as
+one unit, it would be under the license it is marked under. Almost all files will be marked as the
+Ruby license, but some quite substantial portions will be marked as a derived work and is thus GPLv2.
+
+Our goal is to find developers to clean-room those GPLv2 parts and re-license them as the Ruby license.
+Until then, Amp as a project and distributed as one unit is licensed GPLv2.
+
This project includes a large amount of source code from a number of different resources.
They are listed, in no particular order, along with the license ascribed to the code
associated with it.
1. Mercurial (GPLv2)
A large number of algorithms in Amp are inspired by, or in some cases, direct translations,
- of code in the Mercurial source. This makes this our code a derivative work, and thus GPLv2.
+ of code in the Mercurial source. This makes this that code a derivative work, and thus GPLv2.
2. BZ2 (Ruby License) - Guy Decoux
This code has been copied verbatim into our repository.
@@ -37,4 +49,20 @@ associated with it.
5. Minitar - Copyright 2004 Mauricio Julio Fernández Pradier and Austin Ziegler
This code has been copied verbatim into our repository.
- "This program is free software. It may be redistributed and/or modified under the terms of the GPL version 2 (or later) or Ruby’s licence. " -- http://raa.ruby-lang.org/project/minitar/
+ "This program is free software. It may be redistributed and/or modified under the terms of the GPL version 2 (or later) or Ruby’s licence. " -- http://raa.ruby-lang.org/project/minitar/
+
+6. Difflib - this library from Python's standard library has been directly ported to Ruby.
+ It falls under the PSF license, which allows redistribution under a license of our choice. We
+ choose to redistribute it under the Ruby License.
+
+7. HighLine - this library provides some cross-platform terminal methods. The license is included below.
+
+"= License Terms
+
+Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
+{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by
+James Edward Gray II and Greg Brown.
+
+Please email James[mailto:james@grayproductions.net] with any questions."
+
+ We choose to use HighLine's code under the Ruby License.
View
28 Rakefile
@@ -1,4 +1,17 @@
# -*- ruby -*-
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
require 'rake'
require 'rake/tasklib'
@@ -85,21 +98,6 @@ task :prepare do
`tar -C test/localrepo_tests/ -xzf test/localrepo_tests/testrepo.tar.gz`
end
-# liberally modified from Hoe's
-# desc 'Test the amp AWESOMENESS.'
-# task :test do
-# framework = "test/unit"
-# test_globs = ['test/**/test_*.rb']
-# ruby_flags = ENV['RUBY_FLAGS'] || "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" +
-# (ENV['RUBY_DEBUG'] ? " #{ENV['RUBY_DEBUG']}" : '')
-# tests = [ framework] +
-# test_globs.map { |g| Dir.glob(g) }.flatten
-# tests.map! {|f| %(require "#{f}")}
-# cmd = "#{ruby_flags} -e '$amp_testing = true; #{tests.join("; ")}' "
-#
-# ruby cmd
-# end
-
desc "Compile Site"
task :"build-website" do
require 'site/src/helpers.rb'
View
18 ampfile.rb
@@ -1,3 +1,4 @@
+require 'amp/extensions/stats'
# need { 'lib/amp/extensions/ditz' }
# need { 'lib/amp/extensions/lighthouse' }
@@ -20,23 +21,6 @@
<%= change_node.hexlify %> <%= revision %>
EOF
-command "stats" do |c|
- c.workflow :hg
- c.desc "Prints how many commits each user has contributed"
- c.on_run do |opts, args|
- repo = opts[:repository]
- users = Hash.new {|h, k| h[k] = 0}
- repo.each do |changeset|
- users[changeset.user.split("@").first] += 1 #
- end
- users.to_a.sort {|a,b| b[1] <=> a[1]}.each do |u,c|
- puts "#{u}: #{c}"
- end
- end
-end
-
-# bisect_command
-
namespace :docs do
command "gen" do |c|
View
16 lib/amp.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
module Amp; end
# The root directory of this application
Amp::CODE_ROOT = File.expand_path File.dirname(__FILE__)
@@ -36,6 +50,7 @@ module Amp
autoload :Match, "amp/support/match.rb"
autoload :AmpConfig, "amp/support/amp_config.rb"
autoload :UI, "amp/support/amp_ui.rb"
+ autoload :Statistics, "amp/support/statistics.rb"
module Git
autoload :Changeset, "amp/repository/git/repo_format/changeset.rb"
@@ -196,6 +211,7 @@ module Sinatra
require "amp/dependencies/amp_support.rb"
require "amp/support/ruby_19_compatibility.rb"
require "amp/support/support.rb"
+require "amp/dependencies/highline_extensions.rb"
require "amp/templates/template.rb"
require "amp/repository/mercurial/repository.rb" # we're just loading in
require 'amp/repository/git/repository.rb' # all of the base repositories
View
14 lib/amp/commands/command.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
require 'amp/commands/command_support.rb'
module Amp
View
14 lib/amp/commands/command_support.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
module Amp
module CommandSupport
View
14 lib/amp/commands/commands/config.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :config do |c|
c.workflow :all
c.desc "Configure amp interactively."
View
14 lib/amp/commands/commands/help.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :help do |c|
c.workflow :all
c.desc "Prints the help for the program."
View
14 lib/amp/commands/commands/init.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :init do |c|
c.workflow :all
View
14 lib/amp/commands/commands/templates.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
# Create an anonymous module so that the extra methods in the templates aren't
# entered into the global namespace
#
View
14 lib/amp/commands/commands/version.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :version do |c|
c.workflow :all
View
14 lib/amp/commands/commands/workflow.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :workflow do |c|
c.workflow :all
c.maybe_repo
View
14 lib/amp/commands/commands/workflows/git/add.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :add do |c|
c.workflow :git
c.desc "Add a file to the repository (it will be tracked from here on)"
View
14 lib/amp/commands/commands/workflows/git/copy.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :copy do |c|
c.workflow :git
c.desc "Copies a file from one location to another, while maintaining history"
View
14 lib/amp/commands/commands/workflows/git/mv.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :mv do |c|
c.workflow :git
c.desc "Moves a file from one place to another"
View
14 lib/amp/commands/commands/workflows/git/rm.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :rm do |c|
c.workflow :git
c.desc "Removes files from the repository on next commit"
View
25 lib/amp/commands/commands/workflows/hg/add.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :add do |c|
c.workflow :hg
@@ -29,15 +43,12 @@
:includer => opts[:include],
:excluder => opts[:exclude]
names = []
- exact = {}
repo.walk(nil, matcher).each do |file, _|
- if matcher.exact? file
- Amp::UI.status "adding #{file.relative_path repo.root}" if opts[:verbose]
- names << file
- exact[file] = true
- elsif not repo.dirstate.include? file
- Amp::UI.status "adding #{file.relative_path repo.root}"
+ if matcher.exact?(file) || !repo.dirstate.include?(file)
names << file
+ if opts[:verbose] || !matcher.exact?(file)
+ Amp::UI.status "adding #{file.relative_path repo.root}"
+ end
end
end
View
14 lib/amp/commands/commands/workflows/hg/addremove.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
##
# This command will go through your repository's working directory, and if it
# discovers any files that it was tracking, but have mysteriously disappeared,
View
16 lib/amp/commands/commands/workflows/hg/annotate.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :annotate do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/archive.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :archive do |c|
c.workflow :hg
c.desc "Create an unversioned archive of a repository revision"
View
56 lib/amp/commands/commands/workflows/hg/bisect.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :bisect do |c|
c.workflow :hg
@@ -195,46 +211,6 @@ def pretty_print(hash)
end
print ']'
end
-
- # c.on_run do |opts, args|
- # repo = opts[:repository]
- #
- # # Hey! That's a really nice shirt. Where'd you get it?
- # last_good = 0
- # last_bad = repo.size - 1
- # test_rev = last_bad
- # is_good = {} # {revision :: integer => good? :: boolean}
- # a = [true] * 1#((repo.size / 2) + 3)
- # a.concat([false] * (repo.size - a.size))
- # p a
- #
- # run_sample = proc do |test_rev|
- # a[test_rev]
- # end
- #
- # until (last_good - last_bad).abs < 1
- # #repo.revert [], :to => test_rev
- # p [last_good, last_bad]
- #
- # # if the code sample works
- # if run_sample[test_rev]
- # is_good[test_rev] = true # then it's a success and mark it as such
- # break if test_rev == last_good
- # last_good = test_rev
- # else
- # is_good[test_rev] = false
- # last_bad = test_rev
- # end
- #
- # test_rev = (last_good + last_bad) / 2
- # end
- #
- # if is_good[last_bad]
- # Amp::UI.say "The selected range of history passes the test. No bug found."
- # else
- # Amp::UI.say "Revision #{last_bad} has the bug!"
- # end
- # end
end
# Now for some helpers!
View
14 lib/amp/commands/commands/workflows/hg/branch.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :branch do |c|
c.workflow :hg
View
16 lib/amp/commands/commands/workflows/hg/branches.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :branches do |c|
c.workflow :hg
c.desc "Prints the current branches (active and closed)"
View
16 lib/amp/commands/commands/workflows/hg/bundle.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :bundle do |c|
c.workflow :hg
View
16 lib/amp/commands/commands/workflows/hg/clone.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :clone do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/commit.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :commit do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/copy.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :copy do |c|
c.workflow :hg
c.desc "Copies a file from one location to another, while maintaining history"
View
14 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
namespace :debug do
command :dirstate do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/debug/index.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
namespace :debug do
command :index do |c|
View
14 lib/amp/commands/commands/workflows/hg/default.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :default do |c|
c.workflow :hg
c.desc "run the `info` and `status` commands"
View
14 lib/amp/commands/commands/workflows/hg/diff.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :diff do |c|
c.desc "Shows the differences between changesets"
c.opt :color, "Turns on colored formatting", :short => "-c", :default => false
View
14 lib/amp/commands/commands/workflows/hg/forget.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :forget do |c|
c.workflow :hg
c.desc "Remove the file from the staging area"
View
14 lib/amp/commands/commands/workflows/hg/heads.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :heads do |c|
c.workflow :hg
c.desc "Prints the heads of the repository."
View
14 lib/amp/commands/commands/workflows/hg/identify.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :identify do |c|
c.workflow :hg
c.desc "Identifies the current (or another) revision"
View
16 lib/amp/commands/commands/workflows/hg/import.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :import do |c|
c.workflow :hg
c.desc "Import an ordered set of patches"
View
16 lib/amp/commands/commands/workflows/hg/incoming.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :incoming do |c|
c.workflow :hg
c.desc "Show new changesets found in source"
View
14 lib/amp/commands/commands/workflows/hg/info.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :info do |c|
c.workflow :hg
c.desc "Print information about one or more changesets"
View
14 lib/amp/commands/commands/workflows/hg/log.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :log do |c|
c.workflow :hg
c.desc "Prints the commit history."
View
14 lib/amp/commands/commands/workflows/hg/manifest.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :manifest do |c|
c.workflow :hg
c.desc "Prints the manifest at a given revision (defaults to working directory)"
View
16 lib/amp/commands/commands/workflows/hg/merge.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :merge do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/move.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :move do |c|
c.workflow :hg
c.desc "Moves a file from one place to another"
View
16 lib/amp/commands/commands/workflows/hg/outgoing.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :outgoing do |c|
c.workflow :hg
c.opt :limit, "How much of the logs to show", :short => '-l', :type => :integer
View
16 lib/amp/commands/commands/workflows/hg/pull.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :pull do |c|
c.workflow :hg
c.desc "Add a file to the repository (it will be tracked from here on)"
View
16 lib/amp/commands/commands/workflows/hg/push.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :push do |c|
c.workflow :hg
c.desc "Pushes the latest revisions to the remote repository."
View
16 lib/amp/commands/commands/workflows/hg/remove.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :remove do |c|
c.workflow :hg
c.desc "Removes files from the repository on next commit"
View
14 lib/amp/commands/commands/workflows/hg/resolve.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :resolve do |c|
c.workflow :hg
c.desc "Retry file merges, or mark files as successfully hand-merged"
View
14 lib/amp/commands/commands/workflows/hg/revert.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :revert do |c|
c.workflow :hg
c.desc "Restore individual files or dirs to an earlier state"
View
14 lib/amp/commands/commands/workflows/hg/root.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :root do |c|
c.workflow :hg
c.desc "Prints the current repository's root path."
View
14 lib/amp/commands/commands/workflows/hg/serve.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :serve do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/status.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :status do |c|
c.workflow :hg
View
16 lib/amp/commands/commands/workflows/hg/tag.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :tag do |c|
c.workflow :hg
View
16 lib/amp/commands/commands/workflows/hg/tags.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command "tags" do |c|
c.desc "Lists the repository tags."
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/tip.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :tip do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/untrack.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :untrack do |c|
c.workflow :hg
c.desc "Stop tracking the file"
View
14 lib/amp/commands/commands/workflows/hg/update.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :update do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/verify.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :verify do |c|
c.workflow :hg
View
16 lib/amp/commands/commands/workflows/hg/view.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
command :view do |c|
c.workflow :hg
View
14 lib/amp/commands/commands/workflows/hg/what_changed.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
command :"what-changed" do |c|
c.workflow :hg
View
14 lib/amp/commands/dispatch.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
require 'abbrev'
require "amp/commands/command.rb"
require_dir { "commands/*.rb" }
View
14 lib/amp/commands/hooks.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
module Amp
##
View
14 lib/amp/dependencies/amp_support/ruby_amp_support.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
Amp::UI.debug "LOADING RUBY AMP SUPPORT"
##
# Ruby versions of slow functions we've implemented in C
View
240 lib/amp/dependencies/highline_extensions.rb
@@ -0,0 +1,240 @@
+# system_extensions.rb
+#
+# Created by James Edward Gray II on 2006-06-14.
+# Copyright 2006 Gray Productions. All rights reserved.
+#
+# This is Free Software. See LICENSE and COPYING for details.
+#
+# Being used under the Ruby Software License.
+
+module Amp
+ module Support
+ module_function
+
+ JRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
+
+ #
+ # This section builds character reading and terminal size functions
+ # to suit the proper platform we're running on. Be warned: Here be
+ # dragons!
+ #
+ begin
+ # Cygwin will look like Windows, but we want to treat it like a Posix OS:
+ raise LoadError, "Cygwin is a Posix OS." if RUBY_PLATFORM =~ /\bcygwin\b/i
+
+ require "Win32API" # See if we're on Windows.
+
+ CHARACTER_MODE = "Win32API" # For Debugging purposes only.
+
+ #
+ # Windows savvy getc().
+ #
+ #
+ def get_character( input = STDIN )
+ @stdin_handle ||= GetStdHandle(STD_INPUT_HANDLE)
+
+ begin
+ SetConsoleEcho(@stdin_handle, false)
+ input.getbyte
+ ensure
+ SetConsoleEcho(@stdin_handle, true)
+ end
+ end
+
+ # A Windows savvy method to fetch the console columns, and rows.
+ def terminal_size
+ stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE)
+
+ bufx, bufy, curx, cury, wattr, left, top, right, bottom, maxx, maxy =
+ GetConsoleScreenBufferInfo(stdout_handle)
+ return right - left + 1, bottom - top + 1
+ end
+
+ # windows savvy console echo toggler
+ def SetConsoleEcho( console_handle, on )
+ mode = GetConsoleMode(console_handle)
+
+ # toggle the console echo bit
+ if on
+ mode |= ENABLE_ECHO_INPUT
+ else
+ mode &= ~ENABLE_ECHO_INPUT
+ end
+
+ ok = SetConsoleMode(console_handle, mode)
+ end
+
+ # win32 console APIs
+
+ STD_INPUT_HANDLE = -10
+ STD_OUTPUT_HANDLE = -11
+ STD_ERROR_HANDLE = -12
+
+ ENABLE_PROCESSED_INPUT = 0x0001
+ ENABLE_LINE_INPUT = 0x0002
+ ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002
+ ENABLE_ECHO_INPUT = 0x0004
+ ENABLE_WINDOW_INPUT = 0x0008
+ ENABLE_MOUSE_INPUT = 0x0010
+ ENABLE_INSERT_MODE = 0x0020
+ ENABLE_QUICK_EDIT_MODE = 0x0040
+
+ @@apiGetStdHandle = nil
+ @@apiGetConsoleMode = nil
+ @@apiSetConsoleMode = nil
+ @@apiGetConsoleScreenBufferInfo = nil
+
+ def GetStdHandle( handle_type )
+ @@apiGetStdHandle ||= Win32API.new( "kernel32", "GetStdHandle",
+ ['L'], 'L' )
+
+ @@apiGetStdHandle.call( handle_type )
+ end
+
+ def GetConsoleMode( console_handle )
+ @@apiGetConsoleMode ||= Win32API.new( "kernel32", "GetConsoleMode",
+ ['L', 'P'], 'I' )
+
+ mode = ' ' * 4
+ @@apiGetConsoleMode.call(console_handle, mode)
+ mode.unpack('L')[0]
+ end
+
+ def SetConsoleMode( console_handle, mode )
+ @@apiSetConsoleMode ||= Win32API.new( "kernel32", "SetConsoleMode",
+ ['L', 'L'], 'I' )
+
+ @@apiSetConsoleMode.call(console_handle, mode) != 0
+ end
+
+ def GetConsoleScreenBufferInfo( console_handle )
+ @@apiGetConsoleScreenBufferInfo ||=
+ Win32API.new( "kernel32", "GetConsoleScreenBufferInfo",
+ ['L', 'P'], 'L' )
+
+ format = 'SSSSSssssSS'
+ buf = ([0] * format.size).pack(format)
+ @@apiGetConsoleScreenBufferInfo.call(console_handle, buf)
+ buf.unpack(format)
+ end
+
+ rescue LoadError # If we're not on Windows try...
+ begin
+ require "termios" # Unix, first choice termios.
+
+ CHARACTER_MODE = "termios" # For Debugging purposes only.
+
+ #
+ # Unix savvy getc(). (First choice.)
+ #
+ # *WARNING*: This method requires the "termios" library!
+ #
+ def get_character( input = STDIN )
+ old_settings = Termios.getattr(input)
+
+ new_settings = old_settings.dup
+ new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON)
+ new_settings.c_cc[Termios::VMIN] = 1
+
+ begin
+ Termios.setattr(input, Termios::TCSANOW, new_settings)
+ input.getbyte
+ ensure
+ Termios.setattr(input, Termios::TCSANOW, old_settings)
+ end
+ end
+ rescue LoadError # If our first choice fails, try using ffi-ncurses.
+ begin
+ require 'ffi-ncurses' # The ffi gem is builtin to JRUBY and because stty does not
+ # work correctly in JRuby manually installing the ffi-ncurses
+ # gem is the only way to get highline to operate correctly in
+ # JRuby. The ncurses library is only present on unix platforms
+ # so this is not a solution for using highline in JRuby on
+ # windows.
+
+ CHARACTER_MODE = "ncurses" # For Debugging purposes only.
+
+ #
+ # ncurses savvy getc(). (JRuby choice.)
+ #
+ def get_character( input = STDIN )
+ FFI::NCurses.initscr
+ FFI::NCurses.cbreak
+ begin
+ FFI::NCurses.curs_set 0
+ input.getc
+ ensure
+ FFI::NCurses.endwin
+ end
+ end
+
+ rescue LoadError # If the ffi-ncurses choice fails, try using stty
+ if JRUBY
+ STDERR.puts "\n*** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.\n*** jruby -S gem install ffi-ncurses"
+ end
+ CHARACTER_MODE = "stty" # For Debugging purposes only.
+
+ #
+ # Unix savvy getc(). (Second choice.)
+ #
+ # *WARNING*: This method requires the external "stty" program!
+ #
+ def get_character( input = STDIN )
+ raw_no_echo_mode
+
+ begin
+ input.getbyte
+ ensure
+ restore_mode
+ end
+ end
+
+ #
+ # Switched the input mode to raw and disables echo.
+ #
+ # *WARNING*: This method requires the external "stty" program!
+ #
+ def raw_no_echo_mode
+ @state = `stty -g`
+ system "stty raw -echo cbreak isig"
+ end
+
+ #
+ # Restores a previously saved input mode.
+ #
+ # *WARNING*: This method requires the external "stty" program!
+ #
+ def restore_mode
+ system "stty #{@state}"
+ end
+ end
+ end
+ if CHARACTER_MODE == 'ncurses'
+ #
+ # A ncurses savvy method to fetch the console columns, and rows.
+ #
+ def terminal_size
+ size = [80, 40]
+ FFI::NCurses.initscr
+ begin
+ size = FFI::NCurses.getmaxyx(stdscr).reverse
+ ensure
+ FFI::NCurses.endwin
+ end
+ size
+ end
+ else
+ # A Unix savvy method using stty that to fetch the console columns, and rows.
+ # ... stty does not work in JRuby
+ def terminal_size
+ if /solaris/ =~ RUBY_PLATFORM and
+ `stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/
+ [$2, $1].map { |c| x.to_i }
+ else
+ `stty size`.split.map { |x| x.to_i }.reverse
+ end
+ end
+ end
+ end
+ end
+end
View
14 lib/amp/dependencies/python_config.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar 2009-2010 #
+# #
+##################################################################
+
require 'delegate'
Boolean = :bool unless defined? Boolean
View
15 lib/amp/encoding/base85.rb
@@ -1,3 +1,18 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
# = Amp
module Amp
# = Encoding
View
16 lib/amp/encoding/binary_diff.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
module Amp
##
# Binary diffs
View
18 lib/amp/encoding/difflib.rb
@@ -1,3 +1,21 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+#
+# Special Licensing Note:
+# This code is a derivative work from Python's standard library, namely, the
+# difflib module. The PSF allows us to license this code as we like.
+
module Amp
##
# = Difflib
View
14 lib/amp/extensions/ditz.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
namespace :ditz do
command :close do |c|
View
14 lib/amp/extensions/lighthouse.rb
@@ -1,3 +1,17 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
require 'delegate'
require 'rubygems'
require 'lighthouse'
View
79 lib/amp/extensions/stats.rb
@@ -0,0 +1,79 @@
+##################################################################
+# Licensing Information #
+# #
+# The following code is licensed, as standalone code, under #
+# the Ruby License, unless otherwise directed within the code. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+##################################################################
+
+# temporary hack to make sure helper functions don't leak into the global
+# namespace.
+Module.new do
+ ##
+ # Creates the stats command and injects it into the runtime.
+ # Relatively similar to the HG churn command though it shares no
+ # actual lineage - I (Michael Edgar) started this as a simple demonstration
+ # command long before I knew about the official churn extension. I'm adding
+ # some churn features along the way, but this code has nothing to do with churn.
+ command "stats" do |c|
+ c.workflow :hg
+ c.opt :template, "A template string to compute the grouping key. Defaults to <%= user %>.",
+ :type => :string, :default => "<%= user %>", :short => "-t"
+ c.opt :dateformat, "Use formatted date of commit as the grouping key", :type => :string, :short => "-f"
+ c.opt :sort, "Sorts by the grouping key instead of commit/change amount"
+ c.desc "Prints how many commits each user has contributed"
+ c.on_run do |opts, args|
+ repo = opts[:repository]
+ results = Hash.new {|h, k| h[k] = 0}
+
+ # We need a proc that extracts the key to use from the changeset
+ keyproc = build_key_proc opts
+ # Iterate over each changeset, counting changesets based on the key
+ repo.each do |changeset|
+ results[keyproc[changeset]] += 1 #
+ end
+ pairs = results.to_a
+
+ # Sort based on options given
+ sort_pairs! pairs, opts
+
+ # Print our output as a histogram
+ puts Amp::Statistics.histogram(pairs, Amp::Support.terminal_size[0])
+ end
+
+ ##
+ # Prepares a proc that, when run on a changeset, extracts a grouping key
+ # from the changeset. This is highly customizable by the user as it is
+ # the backbone behind providing useful output.
+ #
+ # @param [Hash<Symbol => Object>] opts the opts provided by the user
+ # @return [Proc] a proc that takes a changeset as a parameter and
+ # returns a string key to be used for grouping
+ def build_key_proc(opts)
+ if opts[:dateformat]
+ then keyproc = proc {|changeset| changeset.easy_date.strftime(opts[:dateformat])}
+ else keyproc = proc {|changeset| changeset.to_templated_s(:"template-raw" => opts[:template]) }
+ end
+ end
+
+ ##
+ # Sorts the results based on the options provided to the command by
+ # the user.
+ #
+ # @param [Array<String, Integer>] pairs the pairs of key-value churned results.
+ # will be sorted in-place.
+ # @param [Hash<Symbol => Object>] opts the options provided by the user
+ def sort_pairs!(pairs, opts)
+ if opts[:sort]
+ then pairs.sort! {|a, b| a[0] <=> b[0]} # sort keys ascending
+ else pairs.sort! {|a, b| b[1] <=> a[1]} # sort values descending
+ end
+ end
+ end
+end
View
16 lib/amp/graphs/ancestor.rb
@@ -1,3 +1,19 @@
+#######################################################################
+# Licensing Information #
+# #
+# The following code is a derivative work of the code from the #
+# Mercurial project, which is licensed GPLv2. This code therefore #
+# is also licensed under the terms of the GNU Public License, #
+# verison 2. #
+# #
+# For information on the license of this code when distributed #
+# with and used in conjunction with the other modules in the #
+# Amp project, please see the root-level LICENSE file. #
+# #
+# © Michael J. Edgar and Ari Brown, 2009-2010 #
+# #
+#######################################################################
+
module Amp
module Graphs