amp 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/.hgignore +3 -0
- data/AUTHORS +1 -1
- data/Manifest.txt +99 -38
- data/README.md +3 -3
- data/Rakefile +53 -18
- data/SCHEDULE.markdown +5 -1
- data/TODO.markdown +120 -149
- data/ampfile.rb +3 -1
- data/bin/amp +4 -1
- data/ext/amp/bz2/extconf.rb +1 -1
- data/ext/amp/mercurial_patch/extconf.rb +1 -1
- data/ext/amp/mercurial_patch/mpatch.c +4 -3
- data/ext/amp/priority_queue/extconf.rb +1 -1
- data/ext/amp/support/extconf.rb +1 -1
- data/ext/amp/support/support.c +1 -1
- data/lib/amp.rb +125 -67
- data/lib/amp/commands/command.rb +12 -10
- data/lib/amp/commands/command_support.rb +8 -1
- data/lib/amp/commands/commands/help.rb +2 -20
- data/lib/amp/commands/commands/init.rb +14 -2
- data/lib/amp/commands/commands/templates.rb +6 -4
- data/lib/amp/commands/commands/version.rb +15 -1
- data/lib/amp/commands/commands/workflow.rb +3 -3
- data/lib/amp/commands/commands/workflows/git/add.rb +3 -3
- data/lib/amp/commands/commands/workflows/git/copy.rb +1 -1
- data/lib/amp/commands/commands/workflows/git/rm.rb +4 -2
- data/lib/amp/commands/commands/workflows/hg/add.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/addremove.rb +2 -2
- data/lib/amp/commands/commands/workflows/hg/annotate.rb +8 -2
- data/lib/amp/commands/commands/workflows/hg/bisect.rb +253 -0
- data/lib/amp/commands/commands/workflows/hg/branch.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/branches.rb +3 -3
- data/lib/amp/commands/commands/workflows/hg/bundle.rb +3 -3
- data/lib/amp/commands/commands/workflows/hg/clone.rb +4 -5
- data/lib/amp/commands/commands/workflows/hg/commit.rb +37 -1
- data/lib/amp/commands/commands/workflows/hg/copy.rb +2 -1
- data/lib/amp/commands/commands/workflows/hg/debug/index.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/diff.rb +3 -8
- data/lib/amp/commands/commands/workflows/hg/forget.rb +5 -4
- data/lib/amp/commands/commands/workflows/hg/identify.rb +6 -6
- data/lib/amp/commands/commands/workflows/hg/import.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/incoming.rb +2 -2
- data/lib/amp/commands/commands/workflows/hg/log.rb +5 -4
- data/lib/amp/commands/commands/workflows/hg/merge.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/move.rb +5 -3
- data/lib/amp/commands/commands/workflows/hg/outgoing.rb +1 -1
- data/lib/amp/commands/commands/workflows/hg/push.rb +6 -7
- data/lib/amp/commands/commands/workflows/hg/remove.rb +2 -2
- data/lib/amp/commands/commands/workflows/hg/resolve.rb +6 -23
- data/lib/amp/commands/commands/workflows/hg/root.rb +1 -2
- data/lib/amp/commands/commands/workflows/hg/status.rb +21 -12
- data/lib/amp/commands/commands/workflows/hg/tag.rb +2 -2
- data/lib/amp/commands/commands/workflows/hg/untrack.rb +12 -0
- data/lib/amp/commands/commands/workflows/hg/verify.rb +13 -3
- data/lib/amp/commands/commands/workflows/hg/what_changed.rb +18 -0
- data/lib/amp/commands/dispatch.rb +12 -13
- data/lib/amp/dependencies/amp_support.rb +1 -1
- data/lib/amp/dependencies/amp_support/ruby_amp_support.rb +1 -0
- data/lib/amp/dependencies/maruku.rb +136 -0
- data/lib/amp/dependencies/maruku/attributes.rb +227 -0
- data/lib/amp/dependencies/maruku/defaults.rb +71 -0
- data/lib/amp/dependencies/maruku/errors_management.rb +92 -0
- data/lib/amp/dependencies/maruku/helpers.rb +260 -0
- data/lib/amp/dependencies/maruku/input/charsource.rb +326 -0
- data/lib/amp/dependencies/maruku/input/extensions.rb +69 -0
- data/lib/amp/dependencies/maruku/input/html_helper.rb +189 -0
- data/lib/amp/dependencies/maruku/input/linesource.rb +111 -0
- data/lib/amp/dependencies/maruku/input/parse_block.rb +615 -0
- data/lib/amp/dependencies/maruku/input/parse_doc.rb +234 -0
- data/lib/amp/dependencies/maruku/input/parse_span_better.rb +746 -0
- data/lib/amp/dependencies/maruku/input/rubypants.rb +225 -0
- data/lib/amp/dependencies/maruku/input/type_detection.rb +147 -0
- data/lib/amp/dependencies/maruku/input_textile2/t2_parser.rb +163 -0
- data/lib/amp/dependencies/maruku/maruku.rb +33 -0
- data/lib/amp/dependencies/maruku/output/to_ansi.rb +223 -0
- data/lib/amp/dependencies/maruku/output/to_html.rb +991 -0
- data/lib/amp/dependencies/maruku/output/to_markdown.rb +164 -0
- data/lib/amp/dependencies/maruku/output/to_s.rb +56 -0
- data/lib/amp/dependencies/maruku/string_utils.rb +191 -0
- data/lib/amp/dependencies/maruku/structures.rb +167 -0
- data/lib/amp/dependencies/maruku/structures_inspect.rb +87 -0
- data/lib/amp/dependencies/maruku/structures_iterators.rb +61 -0
- data/lib/amp/dependencies/maruku/textile2.rb +1 -0
- data/lib/amp/dependencies/maruku/toc.rb +199 -0
- data/lib/amp/dependencies/maruku/usage/example1.rb +33 -0
- data/lib/amp/dependencies/maruku/version.rb +40 -0
- data/lib/amp/dependencies/priority_queue.rb +2 -1
- data/lib/amp/dependencies/python_config.rb +2 -1
- data/lib/amp/graphs/ancestor.rb +2 -1
- data/lib/amp/graphs/copies.rb +236 -233
- data/lib/amp/help/entries/__default__.erb +31 -0
- data/lib/amp/help/entries/commands.erb +6 -0
- data/lib/amp/help/entries/mdtest.md +35 -0
- data/lib/amp/help/entries/silly +3 -0
- data/lib/amp/help/help.rb +288 -0
- data/lib/amp/profiling_hacks.rb +5 -3
- data/lib/amp/repository/abstract/abstract_changeset.rb +97 -0
- data/lib/amp/repository/abstract/abstract_local_repo.rb +181 -0
- data/lib/amp/repository/abstract/abstract_staging_area.rb +180 -0
- data/lib/amp/repository/abstract/abstract_versioned_file.rb +100 -0
- data/lib/amp/repository/abstract/common_methods/changeset.rb +75 -0
- data/lib/amp/repository/abstract/common_methods/local_repo.rb +277 -0
- data/lib/amp/repository/abstract/common_methods/staging_area.rb +233 -0
- data/lib/amp/repository/abstract/common_methods/versioned_file.rb +71 -0
- data/lib/amp/repository/generic_repo_picker.rb +78 -0
- data/lib/amp/repository/git/repo_format/changeset.rb +336 -0
- data/lib/amp/repository/git/repo_format/staging_area.rb +192 -0
- data/lib/amp/repository/git/repo_format/versioned_file.rb +119 -0
- data/lib/amp/repository/git/repositories/local_repository.rb +164 -0
- data/lib/amp/repository/git/repository.rb +41 -0
- data/lib/amp/repository/mercurial/encoding/mercurial_diff.rb +382 -0
- data/lib/amp/repository/mercurial/encoding/mercurial_patch.rb +1 -0
- data/lib/amp/repository/mercurial/encoding/patch.rb +294 -0
- data/lib/amp/repository/mercurial/encoding/pure_ruby/ruby_mercurial_patch.rb +124 -0
- data/lib/amp/repository/mercurial/merging/merge_ui.rb +327 -0
- data/lib/amp/repository/mercurial/merging/simple_merge.rb +452 -0
- data/lib/amp/repository/mercurial/repo_format/branch_manager.rb +266 -0
- data/lib/amp/repository/mercurial/repo_format/changeset.rb +768 -0
- data/lib/amp/repository/mercurial/repo_format/dir_state.rb +716 -0
- data/lib/amp/repository/mercurial/repo_format/journal.rb +218 -0
- data/lib/amp/repository/mercurial/repo_format/lock.rb +210 -0
- data/lib/amp/repository/mercurial/repo_format/merge_state.rb +228 -0
- data/lib/amp/repository/mercurial/repo_format/staging_area.rb +367 -0
- data/lib/amp/repository/mercurial/repo_format/store.rb +487 -0
- data/lib/amp/repository/mercurial/repo_format/tag_manager.rb +322 -0
- data/lib/amp/repository/mercurial/repo_format/updatable.rb +543 -0
- data/lib/amp/repository/mercurial/repo_format/updater.rb +848 -0
- data/lib/amp/repository/mercurial/repo_format/verification.rb +433 -0
- data/lib/amp/repository/mercurial/repositories/bundle_repository.rb +216 -0
- data/lib/amp/repository/mercurial/repositories/http_repository.rb +386 -0
- data/lib/amp/repository/mercurial/repositories/local_repository.rb +2034 -0
- data/lib/amp/repository/mercurial/repository.rb +119 -0
- data/lib/amp/repository/mercurial/revlogs/bundle_revlogs.rb +249 -0
- data/lib/amp/repository/mercurial/revlogs/changegroup.rb +217 -0
- data/lib/amp/repository/mercurial/revlogs/changelog.rb +339 -0
- data/lib/amp/repository/mercurial/revlogs/file_log.rb +152 -0
- data/lib/amp/repository/mercurial/revlogs/index.rb +500 -0
- data/lib/amp/repository/mercurial/revlogs/manifest.rb +201 -0
- data/lib/amp/repository/mercurial/revlogs/node.rb +20 -0
- data/lib/amp/repository/mercurial/revlogs/revlog.rb +1026 -0
- data/lib/amp/repository/mercurial/revlogs/revlog_support.rb +129 -0
- data/lib/amp/repository/mercurial/revlogs/versioned_file.rb +597 -0
- data/lib/amp/repository/repository.rb +11 -88
- data/lib/amp/server/extension/amp_extension.rb +3 -3
- data/lib/amp/server/fancy_http_server.rb +1 -1
- data/lib/amp/server/fancy_views/_browser.haml +1 -1
- data/lib/amp/server/fancy_views/_diff_file.haml +1 -8
- data/lib/amp/server/fancy_views/changeset.haml +2 -2
- data/lib/amp/server/fancy_views/file.haml +1 -1
- data/lib/amp/server/fancy_views/file_diff.haml +1 -1
- data/lib/amp/support/amp_ui.rb +13 -29
- data/lib/amp/support/generator.rb +1 -1
- data/lib/amp/support/loaders.rb +1 -2
- data/lib/amp/support/logger.rb +10 -16
- data/lib/amp/support/match.rb +18 -4
- data/lib/amp/support/mercurial/ignore.rb +151 -0
- data/lib/amp/support/openers.rb +8 -3
- data/lib/amp/support/support.rb +91 -46
- data/lib/amp/templates/{blank.commit.erb → mercurial/blank.commit.erb} +0 -0
- data/lib/amp/templates/{blank.log.erb → mercurial/blank.log.erb} +0 -0
- data/lib/amp/templates/{default.commit.erb → mercurial/default.commit.erb} +0 -0
- data/lib/amp/templates/{default.log.erb → mercurial/default.log.erb} +0 -0
- data/lib/amp/templates/template.rb +18 -18
- data/man/amp.1 +51 -0
- data/site/src/about/commands.haml +1 -1
- data/site/src/css/amp.css +1 -1
- data/site/src/index.haml +3 -3
- data/tasks/man.rake +39 -0
- data/tasks/stats.rake +1 -10
- data/tasks/yard.rake +1 -50
- data/test/dirstate_tests/test_dir_state.rb +10 -8
- data/test/functional_tests/annotate.out +31 -0
- data/test/functional_tests/test_functional.rb +155 -63
- data/test/localrepo_tests/ampfile.rb +12 -0
- data/test/localrepo_tests/test_local_repo.rb +56 -57
- data/test/manifest_tests/test_manifest.rb +3 -5
- data/test/merge_tests/test_merge.rb +3 -3
- data/test/revlog_tests/test_revlog.rb +14 -6
- data/test/store_tests/test_fncache_store.rb +19 -19
- data/test/test_19_compatibility.rb +46 -0
- data/test/test_base85.rb +2 -2
- data/test/test_bdiff.rb +2 -2
- data/test/test_changegroup.rb +59 -0
- data/test/test_commands.rb +2 -2
- data/test/test_difflib.rb +2 -2
- data/test/test_generator.rb +34 -0
- data/test/test_ignore.rb +203 -0
- data/test/test_journal.rb +18 -13
- data/test/test_match.rb +2 -2
- data/test/test_mdiff.rb +3 -3
- data/test/test_mpatch.rb +3 -3
- data/test/test_multi_io.rb +40 -0
- data/test/test_support.rb +18 -2
- data/test/test_templates.rb +38 -0
- data/test/test_ui.rb +79 -0
- data/test/testutilities.rb +56 -0
- metadata +168 -49
- data/ext/amp/bz2/mkmf.log +0 -38
- data/lib/amp/encoding/mercurial_diff.rb +0 -378
- data/lib/amp/encoding/mercurial_patch.rb +0 -1
- data/lib/amp/encoding/patch.rb +0 -292
- data/lib/amp/encoding/pure_ruby/ruby_mercurial_patch.rb +0 -123
- data/lib/amp/merges/merge_state.rb +0 -164
- data/lib/amp/merges/merge_ui.rb +0 -322
- data/lib/amp/merges/simple_merge.rb +0 -450
- data/lib/amp/repository/branch_manager.rb +0 -234
- data/lib/amp/repository/dir_state.rb +0 -950
- data/lib/amp/repository/journal.rb +0 -203
- data/lib/amp/repository/lock.rb +0 -207
- data/lib/amp/repository/repositories/bundle_repository.rb +0 -214
- data/lib/amp/repository/repositories/http_repository.rb +0 -377
- data/lib/amp/repository/repositories/local_repository.rb +0 -2661
- data/lib/amp/repository/store.rb +0 -485
- data/lib/amp/repository/tag_manager.rb +0 -319
- data/lib/amp/repository/updatable.rb +0 -532
- data/lib/amp/repository/verification.rb +0 -431
- data/lib/amp/repository/versioned_file.rb +0 -475
- data/lib/amp/revlogs/bundle_revlogs.rb +0 -246
- data/lib/amp/revlogs/changegroup.rb +0 -217
- data/lib/amp/revlogs/changelog.rb +0 -338
- data/lib/amp/revlogs/changeset.rb +0 -521
- data/lib/amp/revlogs/file_log.rb +0 -165
- data/lib/amp/revlogs/index.rb +0 -493
- data/lib/amp/revlogs/manifest.rb +0 -195
- data/lib/amp/revlogs/node.rb +0 -18
- data/lib/amp/revlogs/revlog.rb +0 -1045
- data/lib/amp/revlogs/revlog_support.rb +0 -126
- data/lib/amp/support/ignore.rb +0 -144
- data/site/Rakefile +0 -38
- data/test/test_amp.rb +0 -9
- data/test/test_helper.rb +0 -15
@@ -1,7 +1,7 @@
|
|
1
1
|
command :branches do |c|
|
2
2
|
c.workflow :hg
|
3
3
|
c.desc "Prints the current branches (active and closed)"
|
4
|
-
|
4
|
+
c.opt :active, "Only show active branches", :short => "-a"
|
5
5
|
c.on_run do |opts, args|
|
6
6
|
repo = opts[:repository]
|
7
7
|
|
@@ -10,12 +10,12 @@ command :branches do |c|
|
|
10
10
|
[ active_branches.include?(tag), repo.changelog.rev(node), tag ]
|
11
11
|
end
|
12
12
|
branches.reverse!
|
13
|
-
branches.each do |is_active, node, tag|
|
13
|
+
branches.sort {|a, b| b[1] <=> a[1]}.each do |is_active, node, tag|
|
14
14
|
if !opts[:active] || is_active
|
15
15
|
hexable = repo.lookup(node)
|
16
16
|
if is_active
|
17
17
|
branch_status = ""
|
18
|
-
elsif !(repo.branch_heads(tag, :closed => false).include?(hexable))
|
18
|
+
elsif !(repo.branch_heads(:branch => tag, :closed => false).include?(hexable))
|
19
19
|
notice = " (closed)"
|
20
20
|
else
|
21
21
|
notice = " (inactive)"
|
@@ -53,7 +53,7 @@ EOS
|
|
53
53
|
base = base.map {|b| repo.lookup b }
|
54
54
|
|
55
55
|
o = []
|
56
|
-
has = {Amp::RevlogSupport::Node::NULL_ID => nil}
|
56
|
+
has = {Amp::Mercurial::RevlogSupport::Node::NULL_ID => nil}
|
57
57
|
|
58
58
|
# iterates over each file node id
|
59
59
|
base.each do |filename, node_id|
|
@@ -108,12 +108,12 @@ EOS
|
|
108
108
|
|
109
109
|
# some error checking
|
110
110
|
# yes, this calls Array#include, but the array is only 3 elements
|
111
|
-
unless Amp::RevlogSupport::ChangeGroup::BUNDLE_TYPES.include? bundle_type
|
111
|
+
unless Amp::Mercurial::RevlogSupport::ChangeGroup::BUNDLE_TYPES.include? bundle_type
|
112
112
|
raise abort('unknown bundle type specified with --type')
|
113
113
|
end
|
114
114
|
|
115
115
|
File.open fname, 'w' do |file|
|
116
|
-
Amp::RevlogSupport::ChangeGroup.write_bundle cg, bundle_type, file
|
116
|
+
Amp::Mercurial::RevlogSupport::ChangeGroup.write_bundle cg, bundle_type, file
|
117
117
|
end
|
118
118
|
end # end on_run
|
119
119
|
end
|
@@ -32,7 +32,6 @@ HELP
|
|
32
32
|
require 'uri'
|
33
33
|
|
34
34
|
src, rev, checkout = *c.parse_url(args.shift) # get the source url, revisions we want, and the checkout
|
35
|
-
# puts [src, rev, checkout].inspect
|
36
35
|
source = Amp::Repositories.pick opts[:global_config], src # make it an actual repository
|
37
36
|
dest = (dest = args.shift) || File.basename(src) # get the destination URL
|
38
37
|
|
@@ -54,10 +53,10 @@ HELP
|
|
54
53
|
|
55
54
|
if source.local? && copy # then we're copying
|
56
55
|
FileUtils.copy_entry src, dest # copy everything, pray it's pristine
|
57
|
-
dest_repo = Amp::Repositories::LocalRepository.new dest, false, opts[:global_config]
|
56
|
+
dest_repo = Amp::Repositories::Mercurial::LocalRepository.new dest, false, opts[:global_config]
|
58
57
|
else # we have to pull
|
59
58
|
# make the directory, cd into it, pull, and maaaaaaybe update
|
60
|
-
dest_repo = Amp::Repositories::LocalRepository.new dest, true, opts[:global_config]
|
59
|
+
dest_repo = Amp::Repositories::Mercurial::LocalRepository.new dest, true, opts[:global_config]
|
61
60
|
dest_repo.clone source, :revs => (rev ? rev.map {|r| source.lookup r } : []),
|
62
61
|
:stream => opts[:stream] # the actual cloning which pulls
|
63
62
|
end
|
@@ -91,8 +90,8 @@ HELP
|
|
91
90
|
|
92
91
|
[source, dest_repo]
|
93
92
|
rescue
|
94
|
-
|
95
|
-
|
93
|
+
#FileUtils.remove_entry dest # kill the dir if we've had any problems
|
94
|
+
raise
|
96
95
|
end
|
97
96
|
end
|
98
97
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
command :commit do |c|
|
2
2
|
c.workflow :hg
|
3
3
|
|
4
|
-
c.desc "Commit
|
4
|
+
c.desc "Commit files from the staging area to the repository"
|
5
5
|
c.opt :force, "Forces files to be committed", :short => "-f"
|
6
6
|
c.opt :include, "Includes the given patterns", :short => "-I", :type => :string
|
7
7
|
c.opt :exclude, "Ignores the given patterns", :short => "-E", :type => :string
|
@@ -29,6 +29,7 @@ amp commit [options]+ [FILE]+
|
|
29
29
|
EOS
|
30
30
|
|
31
31
|
c.on_run do |opts, args|
|
32
|
+
|
32
33
|
repo = opts[:repository]
|
33
34
|
|
34
35
|
files = args
|
@@ -37,6 +38,41 @@ EOS
|
|
37
38
|
extra = {}
|
38
39
|
match = Amp::Match.create(:files => files, :includer => included, :excluder => excluded) { !files.any? }
|
39
40
|
opts.merge! :match => match, :extra => extra
|
41
|
+
|
42
|
+
changes = calculate_dirstate_commit(repo, files, match)
|
43
|
+
opts[:modified], opts[:removed] = (changes[:modified] + changes[:added]), changes[:removed]
|
44
|
+
File.open("/log.txt","a") {|f| f.puts "committing: #{opts.inspect} #{args.inspect} #{changes.inspect}\n"}
|
40
45
|
repo.commit opts
|
41
46
|
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Calculates what changes to commit for the given list of files.
|
50
|
+
# Bases this upon the dirstate.
|
51
|
+
#
|
52
|
+
# @param [Array<String>] files the explicit files to check (if any)
|
53
|
+
# @param [Amp::Match] match the matcher object to fall back on
|
54
|
+
# @return [Hash] all the changes from the current dirstate.
|
55
|
+
def calculate_dirstate_commit(repo, files, match)
|
56
|
+
changes = nil
|
57
|
+
if files.any?
|
58
|
+
changes = {:modified => [], :removed => [], :added => []}
|
59
|
+
# split the files up so we can deal with them appropriately
|
60
|
+
files.each do |file|
|
61
|
+
case repo.staging_area.file_status file
|
62
|
+
when :normal, :merged, :added
|
63
|
+
changes[:modified] << file
|
64
|
+
when :removed
|
65
|
+
changes[:removed] << file
|
66
|
+
when :untracked
|
67
|
+
Amp::UI.warn "#{file} not tracked!"
|
68
|
+
else
|
69
|
+
Amp::UI.err "#{file} has unknown state #{state[0]}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
else
|
73
|
+
changes = repo.status(:match => match)
|
74
|
+
end
|
75
|
+
changes
|
76
|
+
end
|
77
|
+
|
42
78
|
end
|
@@ -13,7 +13,7 @@ namespace :debug do
|
|
13
13
|
Amp::UI.say "|---------|------------|------------|----------|-----------|--------------|--------------|--------------|"
|
14
14
|
Amp::UI.say "| rev | offset | length | base | linkrev | nodeid | parent1 | parent2 |"
|
15
15
|
Amp::UI.say "|---------|------------|------------|----------|-----------|--------------|--------------|--------------|"
|
16
|
-
revlog = Amp::Revlog.new(opener, index_file)
|
16
|
+
revlog = Amp::Mercurial::Revlog.new(opener, index_file)
|
17
17
|
idx = 0
|
18
18
|
revlog.each do |entry|
|
19
19
|
node = entry.node_id
|
@@ -9,20 +9,15 @@ command :diff do |c|
|
|
9
9
|
revs << "tip" if revs.size == 0
|
10
10
|
revs << nil if revs.size == 1
|
11
11
|
|
12
|
-
revs.map! {|key| repo[key]}
|
12
|
+
revs.map! {|key| repo[key] }
|
13
13
|
|
14
14
|
differences = repo.status(:node_1 => revs[0], :node_2 => revs[1])
|
15
15
|
files = differences[:added] + differences[:removed] + differences[:deleted] + differences[:modified]
|
16
16
|
|
17
17
|
files.each do |filename|
|
18
|
-
vf_old, vf_new = revs.map {|rev| rev.get_file filename}
|
19
|
-
date_old, date_new = revs.map {|rev| rev.easy_date }
|
20
|
-
path_old, path_new = vf_old.path, vf_new.path || "/dev/null"
|
21
|
-
rev_old, rev_new = vf_old.file_rev, vf_new.file_rev
|
18
|
+
vf_old, vf_new = revs.map {|rev| rev.get_file filename}
|
22
19
|
|
23
|
-
diff =
|
24
|
-
date_new, path_old, path_new,
|
25
|
-
:pretty => !opts[:"no-color"]
|
20
|
+
diff = vf_old.unified_diff_with vf_new, :pretty => !opts[:"no-color"]
|
26
21
|
Amp::UI::say diff
|
27
22
|
end
|
28
23
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
command :forget do |c|
|
2
2
|
c.workflow :hg
|
3
|
-
c.desc "
|
3
|
+
c.desc "Remove the file from the staging area"
|
4
4
|
|
5
5
|
c.on_run do |opts, args|
|
6
6
|
repo = opts[:repository]
|
7
7
|
|
8
|
-
puts "
|
9
|
-
repo.
|
8
|
+
puts "Removing #{args.size} file#{args.size == 1 ? '' : 's'} from the staging area"
|
9
|
+
args.each {|f| repo.staging_area.normal f; print '.'}
|
10
|
+
puts
|
10
11
|
end
|
11
|
-
end
|
12
|
+
end
|
@@ -9,13 +9,13 @@ command :identify do |c|
|
|
9
9
|
c.on_run do |opts, args|
|
10
10
|
repo = opts[:repository]
|
11
11
|
opts[:id] = opts[:num] = true unless opts[:num] || opts[:id] || opts[:branch] || opts[:tags]
|
12
|
-
working_changeset = repo[nil]
|
13
|
-
parent_changeset = working_changeset.parents.first
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
Amp::UI.tell
|
18
|
-
Amp::UI.tell
|
13
|
+
changeset = repo[opts[:rev] || nil]
|
14
|
+
|
15
|
+
Amp::UI.tell changeset.node_id.short_hex + " " if opts[:id]
|
16
|
+
Amp::UI.tell changeset.revision.to_s + " " if opts[:num]
|
17
|
+
Amp::UI.tell changeset.branch + " " if opts[:branch]
|
18
|
+
Amp::UI.tell changeset.tags.join(" ") + " " if opts[:tags]
|
19
19
|
|
20
20
|
Amp::UI.say
|
21
21
|
|
@@ -84,7 +84,7 @@ EOS
|
|
84
84
|
if opts[:exact]
|
85
85
|
raise abort('not a mercurial patch') unless data[:node_id] && data[:p1]
|
86
86
|
p1 = repo.lookup data[:p1]
|
87
|
-
p2 = repo.lookup data[:p2] || Amp::RevlogSupport::Node::NULL_ID.hexlify
|
87
|
+
p2 = repo.lookup data[:p2] || Amp::Mercurial::RevlogSupport::Node::NULL_ID.hexlify
|
88
88
|
|
89
89
|
repo.update(p1, false, true, nil).success? if p1 != wp.first.node
|
90
90
|
repo.dirstate.parents = [p1, p2]
|
@@ -65,10 +65,10 @@ HELP
|
|
65
65
|
bundle_type = (remote.local? && "HG10GZ") || "HG10UN" # ???
|
66
66
|
require 'tempfile'
|
67
67
|
file = Tempfile.new("hg-incoming-bundle", Dir.pwd)
|
68
|
-
Amp::RevlogSupport::ChangeGroup.write_bundle(cg, bundle_type, file)
|
68
|
+
Amp::Mercurial::RevlogSupport::ChangeGroup.write_bundle(cg, bundle_type, file)
|
69
69
|
cleanup = file.path
|
70
70
|
unless remote.local?
|
71
|
-
remote = Amp::Repositories::BundleRepository.new(repo.root, opts[:global_config], cleanup)
|
71
|
+
remote = Amp::Repositories::Mercurial::BundleRepository.new(repo.root, opts[:global_config], cleanup)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
opts.merge! :template_type => :log
|
@@ -1,10 +1,11 @@
|
|
1
1
|
command :log do |c|
|
2
2
|
c.workflow :hg
|
3
3
|
c.desc "Prints the commit history."
|
4
|
-
c.
|
5
|
-
c.
|
6
|
-
c.
|
7
|
-
c.
|
4
|
+
c.opt :verbose, "Verbose output", {:short => "-v"}
|
5
|
+
c.opt :limit, "Limit how many revisions to show", {:short => "-l", :type => :integer, :default => -1}
|
6
|
+
c.opt :template, "Which template to use while printing", {:short => "-t", :type => :string, :default => "default"}
|
7
|
+
c.opt :no_output, "Doesn't print output (useful for benchmarking)"
|
8
|
+
|
8
9
|
c.on_run do |options, args|
|
9
10
|
repo = options[:repository]
|
10
11
|
limit = options[:limit]
|
@@ -9,7 +9,7 @@ command :merge do |c|
|
|
9
9
|
repo = opts[:repository]
|
10
10
|
if !opts[:rev]
|
11
11
|
branch = repo[nil].branch
|
12
|
-
bheads = repo.branch_heads
|
12
|
+
bheads = repo.branch_heads(:branch => branch)
|
13
13
|
if bheads.size > 2
|
14
14
|
raise abort("branch #{branch} has #{bheads.size} - please merge " +
|
15
15
|
" with an explicit revision")
|
@@ -10,13 +10,15 @@ command :move do |c|
|
|
10
10
|
c.before do |opts, args|
|
11
11
|
if args.size < 2
|
12
12
|
Amp::UI.say "Usage: amp move source destination"
|
13
|
-
|
13
|
+
cut!
|
14
14
|
elsif args.size > 2 && !File.directory?(args.last)
|
15
15
|
Amp::UI.say "If you want to move more than 1 file, your destination must" +
|
16
16
|
" be a directory."
|
17
|
-
|
17
|
+
cut!
|
18
|
+
else
|
19
|
+
true
|
18
20
|
end
|
19
|
-
|
21
|
+
|
20
22
|
end
|
21
23
|
|
22
24
|
c.on_run do |opts, args|
|
@@ -49,7 +49,7 @@ HELP
|
|
49
49
|
o.each do |node_id|
|
50
50
|
# get the parents of the node so that we can check if it's a merge
|
51
51
|
# (merges have two parents)
|
52
|
-
parents = repo.
|
52
|
+
parents = repo[node_id].parents
|
53
53
|
|
54
54
|
# We skip printing this if it's a merge (parents.size == 2)
|
55
55
|
# and we're NOT printing merges (opts[:"no-merges"])
|
@@ -6,14 +6,13 @@ command :push do |c|
|
|
6
6
|
c.opt :force, "Ignore remote heads", :short => "-f"
|
7
7
|
|
8
8
|
c.on_run do |opts, args|
|
9
|
-
repo
|
10
|
-
dest
|
11
|
-
opts[:revs]
|
12
|
-
remote
|
9
|
+
repo = opts[:repository]
|
10
|
+
dest = opts[:remote] || repo.config["paths","default-push"] || repo.config["paths","default"]
|
11
|
+
opts[:revs] ||= nil
|
12
|
+
remote = Amp::Support.parse_hg_url(dest, opts[:revs])
|
13
13
|
dest, revs, checkout = remote[:url], remote[:revs], remote[:head]
|
14
|
-
remote_repo
|
15
|
-
|
16
|
-
revs = revs.map {|rev| repo.lookup rev } if revs
|
14
|
+
remote_repo = Amp::Repositories.pick(repo.config, dest, false)
|
15
|
+
revs = revs.map {|rev| repo.lookup rev } if revs
|
17
16
|
|
18
17
|
result = repo.push remote_repo, :force => opts[:force], :revs => revs
|
19
18
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
command :remove do |c|
|
2
2
|
c.workflow :hg
|
3
3
|
c.desc "Removes files from the repository on next commit"
|
4
|
-
c.opt :
|
4
|
+
c.opt :"no-unlink", "Don't unlink the files", :short => "-A", :default => false
|
5
5
|
c.opt :force, "Forces removal of files", :short => "-f", :default => false
|
6
6
|
c.opt :include, "include names matching the given patterns", :short => "-I", :type => :string
|
7
7
|
c.opt :exclude, "exclude names matching the given patterns", :short => "-X", :type => :string
|
@@ -31,7 +31,7 @@ command :remove do |c|
|
|
31
31
|
(remove + forget).sort.each {|f| Amp::UI.status "removing #{f}..." }
|
32
32
|
end
|
33
33
|
|
34
|
-
repo.remove(remove, :unlink => ! opts[:
|
34
|
+
repo.staging_area.remove(remove, :unlink => ! opts[:"no-unlink"]) # forgetting occurs here
|
35
35
|
repo.forget(forget)
|
36
36
|
|
37
37
|
remove += forget
|
@@ -9,10 +9,8 @@ command :resolve do |c|
|
|
9
9
|
c.opt :exclude, "Specify patterns of files to exclude in the operation", :short => "-E", :type => :string
|
10
10
|
|
11
11
|
c.before do |opts, args|
|
12
|
-
parse_args = lambda {|os| [:all, :mark, :unmark, :list].map {|i| os[i] } }
|
13
|
-
|
14
12
|
# Checks to make sure user input is valid
|
15
|
-
all, mark, unmark, list =
|
13
|
+
all, mark, unmark, list = [:all, :mark, :unmark, :list].map {|i| opts[i] }
|
16
14
|
|
17
15
|
if (list && (mark || unmark)) || (mark && unmark)
|
18
16
|
raise abort("too many options specified")
|
@@ -31,10 +29,8 @@ command :resolve do |c|
|
|
31
29
|
|
32
30
|
c.on_run do |opts, args|
|
33
31
|
repo = opts[:repository]
|
34
|
-
parse_args = lambda {|os| [:all, :mark, :unmark, :list].map {|i| os[i] } }
|
35
32
|
|
36
|
-
all, mark, unmark, list =
|
37
|
-
merge_state = Amp::Merges::MergeState.new(repo)
|
33
|
+
all, mark, unmark, list = [:all, :mark, :unmark, :list].map {|i| opts[i] }
|
38
34
|
|
39
35
|
if opts[:all]
|
40
36
|
# the block means "default to true" - so basically ignore all other input
|
@@ -47,34 +43,21 @@ command :resolve do |c|
|
|
47
43
|
end
|
48
44
|
|
49
45
|
# iterate over each entry in the merge state file
|
50
|
-
|
46
|
+
repo.uncommitted_merge_files.each do |file, status|
|
51
47
|
# check to see if our user wants this file
|
52
48
|
if match.call(file)
|
53
49
|
if list
|
54
50
|
Amp::UI.say "#{status.first} #{file}"
|
55
51
|
elsif mark
|
56
52
|
# the "r" means resolved
|
57
|
-
|
53
|
+
repo.mark_resolved(file)
|
58
54
|
Amp::UI.say "#{file} marked as #{"resolved".blue}"
|
59
55
|
elsif unmark
|
60
56
|
# the "u" means unresolved
|
61
|
-
|
57
|
+
repo.mark_conflicted(file)
|
62
58
|
Amp::UI.say "#{file} marked as #{"unresolved".red}"
|
63
59
|
else
|
64
|
-
|
65
|
-
working_changeset = repo[nil]
|
66
|
-
merge_changeset = working_changeset.parents.last
|
67
|
-
|
68
|
-
# backup the current file to a .resolve file (but retain the extension
|
69
|
-
# so editors that rely on extensions won't bug out)
|
70
|
-
path = repo.working_join file
|
71
|
-
File.copy(path, path + ".resolve" + File.extname(path))
|
72
|
-
|
73
|
-
# try to merge the files!
|
74
|
-
merge_state.resolve(file, working_changeset, merge_changeset)
|
75
|
-
|
76
|
-
# restore the backup to .orig (overwriting the old one)
|
77
|
-
File.move(path + ".resolve" + File.extname(path), path + ".orig" + File.extname(path))
|
60
|
+
repo.try_resolve_conflict(file)
|
78
61
|
end
|
79
62
|
end
|
80
63
|
end
|
@@ -26,9 +26,11 @@ command :status do |c|
|
|
26
26
|
'added' => :blue,
|
27
27
|
'removed' => :red,
|
28
28
|
'deleted' => :magenta,
|
29
|
+
'copied' => :blue,
|
30
|
+
'moved' => :red,
|
29
31
|
'unknown' => :green,
|
30
32
|
'ignored' => :yellow,
|
31
|
-
'clean' => :white
|
33
|
+
'clean' => :white,
|
32
34
|
}
|
33
35
|
states = ['modified',
|
34
36
|
'added' ,
|
@@ -36,11 +38,13 @@ command :status do |c|
|
|
36
38
|
'deleted' ,
|
37
39
|
'unknown' ,
|
38
40
|
'ignored' ,
|
39
|
-
'clean'
|
41
|
+
'clean' ,
|
42
|
+
'copied' ,
|
43
|
+
'moved' ]
|
40
44
|
show = states.select {|k| options[k.to_sym] } # filter the list down
|
41
|
-
|
42
45
|
show = states if options[:all]
|
43
46
|
show = states[0..4] if show.empty?
|
47
|
+
#show += states[7..8] unless options[:hg]
|
44
48
|
|
45
49
|
statopts = {:node_1 => node1, :node_2 => node2 }
|
46
50
|
|
@@ -65,7 +69,6 @@ command :status do |c|
|
|
65
69
|
changestates.each do |state, char, files|
|
66
70
|
if show.include? state
|
67
71
|
files.each do |f|
|
68
|
-
#Amp::Logger.info("#{char} #{f}")
|
69
72
|
if options[:"no-color"]
|
70
73
|
Amp::UI.tell "#{char} #{File.join(cwd, f.to_s)[1..-1]}#{stop}" unless f.nil?
|
71
74
|
else
|
@@ -82,21 +85,27 @@ command :status do |c|
|
|
82
85
|
|
83
86
|
if options[:"no-color"]
|
84
87
|
Amp::UI.say("#{state.upcase}" +
|
85
|
-
" => #{num_of_files} file#{num_of_files == 1 ? '
|
88
|
+
" => #{num_of_files} file#{num_of_files == 1 ? '' : 's'}")
|
86
89
|
else
|
87
90
|
Amp::UI.say("#{state.upcase.send colors[state]}" +
|
88
|
-
" => #{num_of_files} file#{num_of_files == 1 ? '
|
91
|
+
" => #{num_of_files} file#{num_of_files == 1 ? '' : 's'}")
|
89
92
|
end
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
+
unless [:copied, :moved].include? state.to_sym
|
95
|
+
status[state.to_sym].each do |file|
|
96
|
+
Amp::UI.say "\t#{File.join(cwd, file)[1..-1]}"
|
97
|
+
end
|
98
|
+
else
|
99
|
+
status[state.to_sym].each do |(src, dst)|
|
100
|
+
Amp::UI.say "\t#{File.join(cwd, src)[1..-1]} => #{File.join(cwd, dst)[1..-1]}"
|
101
|
+
end
|
94
102
|
end
|
95
|
-
|
96
103
|
end
|
97
104
|
|
98
|
-
|
99
|
-
|
105
|
+
unless show.map {|s| status[s.to_sym] }.all? {|s| s.empty? }
|
106
|
+
Amp::UI.say
|
107
|
+
Amp::UI.say "#{status[:delta]} bytes were changed" if status[:delta]
|
108
|
+
end
|
100
109
|
end
|
101
110
|
end
|
102
111
|
|