hglib 0.8.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.md +34 -0
- data/README.md +1 -1
- data/lib/hglib.rb +1 -1
- data/lib/hglib/repo.rb +48 -0
- data/lib/hglib/repo/status_entry.rb +49 -0
- data/lib/hglib/server.rb +1 -1
- data/spec/hglib/repo/status_entry_spec.rb +48 -0
- data/spec/hglib/repo_spec.rb +52 -0
- metadata +32 -27
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49414cda8ac1d182dc28c5ea23052a30570a8639e25b86a24c668a704ac36a2f
|
4
|
+
data.tar.gz: b2bc6ceaa334cc1717991eb68abec0552907f3b9106397bd282170de4ca120c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a091ecc6a40aaf50f7215376b24c0b2b832af483c4e70d14715c5d3c0ef0fd6ce1f88514d1d727c1eb2eb1cfd20a4d1077a2b66783facaa233a63f59568370
|
7
|
+
data.tar.gz: 71caea3abc57dbc8e46bebbb95bd9b2618396151f09ec9b2c2f0fdeef06cbaa75ae608554452fb9970ee158da4a4ba6ea4d30e8f46851b43df56a9c730799deb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.md
CHANGED
@@ -1,6 +1,40 @@
|
|
1
1
|
# Release History for hglib
|
2
2
|
|
3
3
|
---
|
4
|
+
## v0.11.0 [2020-12-28] Michael Granger <ged@FaerieMUD.org>
|
5
|
+
|
6
|
+
Improvements:
|
7
|
+
|
8
|
+
- Update dependency for Ruby 3.
|
9
|
+
|
10
|
+
|
11
|
+
## v0.10.1 [2020-04-02] Michael Granger <ged@FaerieMUD.org>
|
12
|
+
|
13
|
+
Bugfixes:
|
14
|
+
|
15
|
+
- Fix the Repo#tracked? predicate.
|
16
|
+
|
17
|
+
|
18
|
+
## v0.10.0 [2020-04-02] Michael Granger <ged@FaerieMUD.org>
|
19
|
+
|
20
|
+
Improvements:
|
21
|
+
|
22
|
+
- Added file status predicates.
|
23
|
+
|
24
|
+
|
25
|
+
## v0.9.0 [2020-03-04] Michael Granger <ged@FaerieMUD.org>
|
26
|
+
|
27
|
+
Improvements:
|
28
|
+
|
29
|
+
- Add Repo#remove, #rename, and #forget.
|
30
|
+
|
31
|
+
|
32
|
+
## v0.8.1 [2020-02-19] Michael Granger <ged@FaerieMUD.org>
|
33
|
+
|
34
|
+
Improvements:
|
35
|
+
|
36
|
+
- Turn down logging on error responses from the server
|
37
|
+
|
4
38
|
|
5
39
|
## v0.8.0 [2020-01-21] Michael Granger <ged@FaerieMUD.org>
|
6
40
|
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ that uses the [Command Server][cmdserver] for efficiency.
|
|
24
24
|
|
25
25
|
require 'hglib'
|
26
26
|
|
27
|
-
repo = Hglib.clone( 'https://
|
27
|
+
repo = Hglib.clone( 'https://hg.sr.ht/~ged/hglib' )
|
28
28
|
# => #<Hglib::Repo:0x00007fae3880ec90 @path=#<Pathname:/Users/ged/temp/hglib>, @server=nil>
|
29
29
|
|
30
30
|
|
data/lib/hglib.rb
CHANGED
data/lib/hglib/repo.rb
CHANGED
@@ -102,6 +102,47 @@ class Hglib::Repo
|
|
102
102
|
end
|
103
103
|
|
104
104
|
|
105
|
+
### Schedule the given +files+ to be removed from the current branch.
|
106
|
+
def remove( *files, **options )
|
107
|
+
self.server.run( :remove, *files, **options )
|
108
|
+
return true
|
109
|
+
end
|
110
|
+
alias_method :rm, :remove
|
111
|
+
|
112
|
+
|
113
|
+
### Rename files; equivalent of copy + remove
|
114
|
+
###
|
115
|
+
### Mark +dest+ as copies of +sources+; mark +sources+ (which can be a single
|
116
|
+
### path or an Array of paths) for deletion. If +dest+ is a directory, copies
|
117
|
+
### are put in that directory. If +dest+ is a file, there can only be one
|
118
|
+
### +source+.
|
119
|
+
###
|
120
|
+
### By default, this command copies the contents of files as they exist in the
|
121
|
+
### working directory. If invoked with the :after option, the operation is recorded,
|
122
|
+
### but no copying is performed.
|
123
|
+
###
|
124
|
+
### This command takes effect at the next commit. To undo a rename before
|
125
|
+
### that, see 'hg revert'.
|
126
|
+
def rename( sources, dest, **options )
|
127
|
+
files = Array( sources ) + [ dest ]
|
128
|
+
self.server.run( :rename, *files, **options )
|
129
|
+
return true
|
130
|
+
end
|
131
|
+
alias_method :move, :rename
|
132
|
+
alias_method :mv, :rename
|
133
|
+
|
134
|
+
|
135
|
+
### Mark the specified +files+ so they will no longer be tracked after the next
|
136
|
+
### commit.
|
137
|
+
###
|
138
|
+
### This only removes +files+ from the current branch, not from the entire
|
139
|
+
### project history, and it does not delete them from the working directory.
|
140
|
+
def forget( *files, **options )
|
141
|
+
self.server.run( :forget, *files, **options )
|
142
|
+
return true
|
143
|
+
end
|
144
|
+
|
145
|
+
|
105
146
|
### Add all new files and remove all missing files from the repository.
|
106
147
|
###
|
107
148
|
### Unless +files+ are given, new files are ignored if they match any of the
|
@@ -259,6 +300,13 @@ class Hglib::Repo
|
|
259
300
|
end
|
260
301
|
|
261
302
|
|
303
|
+
### Returns +true+ if the given +filename+ is a file tracked by Mercurial.
|
304
|
+
def tracked?( filename )
|
305
|
+
status = self.status( filename ).first
|
306
|
+
return status&.tracked?
|
307
|
+
end
|
308
|
+
|
309
|
+
|
262
310
|
### Returns +true+ if all of the changesets in the specified +revset+ (or the
|
263
311
|
### current changeset if no +revset+ is given) are in the public phase.
|
264
312
|
def public?( revset=nil )
|
@@ -62,6 +62,55 @@ class Hglib::Repo::StatusEntry
|
|
62
62
|
end
|
63
63
|
|
64
64
|
|
65
|
+
### Returns +true+ if the status is 'modified'.
|
66
|
+
def modified?
|
67
|
+
return self.status == 'M'
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
### Returns +true+ if the status is 'added'.
|
72
|
+
def added?
|
73
|
+
return self.status == 'A'
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
### Returns +true+ if the status is 'removed'.
|
78
|
+
def removed?
|
79
|
+
return self.status == 'R'
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
### Returns +true+ if the status is 'clean'.
|
84
|
+
def clean?
|
85
|
+
return self.status == 'C'
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
### Returns +true+ if the status is 'missing'.
|
90
|
+
def missing?
|
91
|
+
return self.status == '!'
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
### Returns +true+ if the status is 'not tracked'.
|
96
|
+
def not_tracked?
|
97
|
+
return self.status == '?'
|
98
|
+
end
|
99
|
+
alias_method :untracked?, :not_tracked?
|
100
|
+
|
101
|
+
|
102
|
+
### Returns +true+ if the status is anything other than 'not tracked'.
|
103
|
+
def tracked?
|
104
|
+
return !self.not_tracked?
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
### Returns +true+ if the status is 'ignored'.
|
109
|
+
def ignored?
|
110
|
+
return self.status == 'I'
|
111
|
+
end
|
112
|
+
|
113
|
+
|
65
114
|
### Return a human-readable representation of the StatusEntry as a String.
|
66
115
|
def inspect
|
67
116
|
return "#<%p:#%x %s: %s%s>" % [
|
data/lib/hglib/server.rb
CHANGED
@@ -175,7 +175,7 @@ class Hglib::Server
|
|
175
175
|
when 'r'
|
176
176
|
done = true
|
177
177
|
when 'e'
|
178
|
-
self.log.
|
178
|
+
self.log.debug "Got command error: %p" % [ data ]
|
179
179
|
errors << data
|
180
180
|
when 'L'
|
181
181
|
self.log.debug "Server requested line input (%d bytes)" % [ data ]
|
@@ -38,5 +38,53 @@ RSpec.describe Hglib::Repo::StatusEntry do
|
|
38
38
|
expect( entry.status_description ).to eq( 'added' )
|
39
39
|
end
|
40
40
|
|
41
|
+
|
42
|
+
it "knows if its file has been modified" do
|
43
|
+
entry = described_class.new( RAW_STATUS_ENTRY )
|
44
|
+
expect( entry ).to be_modified
|
45
|
+
end
|
46
|
+
|
47
|
+
# when 'A' then 'added'
|
48
|
+
# when 'R' then 'removed'
|
49
|
+
# when 'C' then 'clean'
|
50
|
+
# when '!' then 'missing'
|
51
|
+
# when '?' then 'not tracked'
|
52
|
+
# when 'I' then 'ignored'
|
53
|
+
|
54
|
+
it "knows if its file has been scheduled for removal" do
|
55
|
+
entry = described_class.new( RAW_STATUS_ENTRY.merge(status: 'R') )
|
56
|
+
expect( entry ).to be_removed
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
it "knows if its file is clean" do
|
61
|
+
entry = described_class.new( RAW_STATUS_ENTRY.merge(status: 'C') )
|
62
|
+
expect( entry ).to be_clean
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
it "knows if its file is missing" do
|
67
|
+
entry = described_class.new( RAW_STATUS_ENTRY.merge(status: '!') )
|
68
|
+
expect( entry ).to be_missing
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
it "knows if its file is untracked" do
|
73
|
+
entry = described_class.new( RAW_STATUS_ENTRY.merge(status: '?') )
|
74
|
+
expect( entry ).to be_untracked
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
it "knows if its file is tracked" do
|
79
|
+
entry = described_class.new( RAW_STATUS_ENTRY )
|
80
|
+
expect( entry ).to be_tracked
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
it "knows if its file is ignored" do
|
85
|
+
entry = described_class.new( RAW_STATUS_ENTRY.merge(status: 'I') )
|
86
|
+
expect( entry ).to be_ignored
|
87
|
+
end
|
88
|
+
|
41
89
|
end
|
42
90
|
|
data/spec/hglib/repo_spec.rb
CHANGED
@@ -69,6 +69,18 @@ RSpec.describe Hglib::Repo do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
|
72
|
+
it "can ensure a file is tracked" do
|
73
|
+
repo = described_class.new( repo_dir )
|
74
|
+
|
75
|
+
expect( server ).to receive( :run_with_json_template ).
|
76
|
+
with( :status, 'lib/version.rb' ).
|
77
|
+
and_return([ {path: 'lib/version.rb', status: 'M'} ]).
|
78
|
+
at_least( :once )
|
79
|
+
|
80
|
+
expect( repo.tracked?('lib/version.rb') ).to be_truthy
|
81
|
+
end
|
82
|
+
|
83
|
+
|
72
84
|
it "can fetch the identification of the repository's current revision" do
|
73
85
|
repo = described_class.new( repo_dir )
|
74
86
|
|
@@ -204,6 +216,46 @@ RSpec.describe Hglib::Repo do
|
|
204
216
|
end
|
205
217
|
|
206
218
|
|
219
|
+
it "can remove tracked files from the repository" do
|
220
|
+
repo = described_class.new( repo_dir )
|
221
|
+
|
222
|
+
expect( server ).to receive( :run ).with( :remove, "stripe.apikey" )
|
223
|
+
|
224
|
+
result = repo.rm( 'stripe.apikey' )
|
225
|
+
expect( result ).to be_truthy
|
226
|
+
end
|
227
|
+
|
228
|
+
|
229
|
+
it "can mark files so they will no longer be tracked after the next commit" do
|
230
|
+
repo = described_class.new( repo_dir )
|
231
|
+
|
232
|
+
expect( server ).to receive( :run ).with( :forget, "ChangeLog" )
|
233
|
+
|
234
|
+
result = repo.forget( 'ChangeLog' )
|
235
|
+
expect( result ).to be_truthy
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
it "can rename files in the repository" do
|
240
|
+
repo = described_class.new( repo_dir )
|
241
|
+
|
242
|
+
expect( server ).to receive( :run ).with( :rename, "README.rdoc", "README.md" )
|
243
|
+
|
244
|
+
result = repo.mv( 'README.rdoc', 'README.md' )
|
245
|
+
expect( result ).to be_truthy
|
246
|
+
end
|
247
|
+
|
248
|
+
|
249
|
+
it "can record all adds/moves/removes in a directory" do
|
250
|
+
repo = described_class.new( repo_dir )
|
251
|
+
|
252
|
+
expect( server ).to receive( :run ).with( :addremove, any_args )
|
253
|
+
|
254
|
+
result = repo.addremove
|
255
|
+
expect( result ).to be_truthy
|
256
|
+
end
|
257
|
+
|
258
|
+
|
207
259
|
it "can return the current Mercurial configuration" do
|
208
260
|
repo = described_class.new( repo_dir )
|
209
261
|
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hglib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MIID+DCCAmCgAwIBAgIBAzANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
|
14
|
+
REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMDEyMjQyMDU1MjlaFw0yMTEyMjQyMDU1
|
15
|
+
MjlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
|
16
16
|
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
|
17
17
|
L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
|
18
18
|
M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
|
@@ -21,20 +21,19 @@ cert_chain:
|
|
21
21
|
vQ66lts4alKC69TE5cuKasWBm+16A4aEe3XdZBRNmtOu/g81gvwA7fkJHKllJuaI
|
22
22
|
dXzdHqq+zbGZVSQ7pRYHYomD0IiDe1DbIouFnPWmagaBnGHwXkDT2bKKP+s2v21m
|
23
23
|
ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
|
24
|
-
N2I4L/ZOIe2DIVuYH7aLHfjZDQv/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
XrxOxp8o0uOkU7FdLSGsyqJ2LzsR4obN
|
24
|
+
N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
|
25
|
+
VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
|
26
|
+
9w0BAQsFAAOCAYEAMYegZanJi8zq7QKPT7wqXefX4C88I5JWeBHR3PvvWK0CwyMV
|
27
|
+
peyiu5I13w/lYX+HUZjE4qsSpJMJFXWl4WZCOo+AMprOcf0PxfuJpxCej5D4tavf
|
28
|
+
vRfhahSw7XJrcZih/3J+/UgoH7R05MJ+8LTcy3HGrB3a0vTafjm8OY7Xpa0LJDoN
|
29
|
+
JDqxK321VIHyTibbKeA1hWSE6ljlQDvFbTqiCj3Ulp1jTv3TOlvRl8fqcfhxUJI0
|
30
|
+
+5Q82jJODjEN+GaWs0V+NlrbU94cXwS2PH5dXogftB5YYA5Ex8A0ikZ73xns4Hdo
|
31
|
+
XxdLdd92F5ovxA23j/rKe/IDwqr6FpDkU3nPXH/Qp0TVGv9zZnVJc/Z6ChkuWj8z
|
32
|
+
pW7JAyyiiHZgKKDReDrA2LA7Zs3o/7KA6UtUH0FHf8LYhcK+pfHk6RtjRe65ffw+
|
33
|
+
MCh97sQ/Z/MOusb5+QddBmB+k8EicXyGNl4b5L4XpL7fIQu+Y96TB3JEJlShxFD9
|
34
|
+
k9FjI4d9EP54gS/4
|
36
35
|
-----END CERTIFICATE-----
|
37
|
-
date: 2020-
|
36
|
+
date: 2020-12-28 00:00:00.000000000 Z
|
38
37
|
dependencies:
|
39
38
|
- !ruby/object:Gem::Dependency
|
40
39
|
name: loggability
|
@@ -106,9 +105,8 @@ dependencies:
|
|
106
105
|
- - "~>"
|
107
106
|
- !ruby/object:Gem::Version
|
108
107
|
version: '0.4'
|
109
|
-
description:
|
110
|
-
|
111
|
-
that uses the {Command Server}[https://www.mercurial-scm.org/wiki/CommandServer] for efficiency.
|
108
|
+
description: This is a client library for the Mercurial distributed revision control
|
109
|
+
tool that uses the Command Server for efficiency.
|
112
110
|
email:
|
113
111
|
- ged@FaerieMUD.org
|
114
112
|
executables: []
|
@@ -147,8 +145,13 @@ files:
|
|
147
145
|
homepage: https://hg.sr.ht/~ged/hglib
|
148
146
|
licenses:
|
149
147
|
- BSD-3-Clause
|
150
|
-
metadata:
|
151
|
-
|
148
|
+
metadata:
|
149
|
+
homepage_uri: https://hg.sr.ht/~ged/hglib
|
150
|
+
documentation_uri: http://deveiate.org/code/hglib
|
151
|
+
changelog_uri: http://deveiate.org/code/hglib/History_md.html
|
152
|
+
source_uri: https://hg.sr.ht/~ged/hglib
|
153
|
+
bug_tracker_uri: https://todo.sr.ht/~ged/hglib
|
154
|
+
post_install_message:
|
152
155
|
rdoc_options: []
|
153
156
|
require_paths:
|
154
157
|
- lib
|
@@ -157,16 +160,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
160
|
- - "~>"
|
158
161
|
- !ruby/object:Gem::Version
|
159
162
|
version: '2.5'
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '3.0'
|
160
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
167
|
requirements:
|
162
168
|
- - ">="
|
163
169
|
- !ruby/object:Gem::Version
|
164
170
|
version: '0'
|
165
171
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
167
|
-
signing_key:
|
172
|
+
rubygems_version: 3.2.3
|
173
|
+
signing_key:
|
168
174
|
specification_version: 4
|
169
175
|
summary: This is a client library for the Mercurial distributed revision control tool
|
170
|
-
that uses the
|
171
|
-
for efficiency.
|
176
|
+
that uses the Command Server for efficiency.
|
172
177
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|