hglib 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b44a7bfe2cfb5f6a8ef10442f151fe85ab0299622d2d0531da868a56da9c3be
4
- data.tar.gz: 297997d18c6ae2052127b14a5edd0b7caeac0b36511c14f72f53cf03439159c1
3
+ metadata.gz: bed2aab2e2a8f472ce66fddf9dddcd469ae1b8a5db7ff213f3ec1223025b11ae
4
+ data.tar.gz: 5faec9749f727cb31aea87ef13f293a2da281353e8e0c23e09d6aa7299baf28c
5
5
  SHA512:
6
- metadata.gz: 2a1064d476c0da406d388fbf258f401a61f827f3474dec57957f403dbf16e687b3aab560734140e85a0507a4846d5985363ea44260f203af70ffa5d951763c0e
7
- data.tar.gz: ebc36258eacf58603c98eae67bce359f0c633dfc48442aff0c76078db074ba10a7ffe5d393109439ca4723b029b73dbbe7aea349372ad6db5f6a81b9c28c549f
6
+ metadata.gz: 360868b5befb696d2f4fdeaaf610ac64b1a83fa148c7e7b4176db619762e8c6841736721893862d03c904114b151749ef5e0fdef242cf41d48adceb7aa19e38d
7
+ data.tar.gz: 844af0536bba415de4019744d72c19e20061fadfcbb9060b0ebbe464945830f1f40660b73454247117c739c2d249135641f1cd53ecb41a6c7d30d07e2fc31414
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## v0.10.0 [2020-04-02] Michael Granger <ged@FaerieMUD.org>
6
+
7
+ Improvements:
8
+
9
+ - Added file status predicates.
10
+
11
+
5
12
  ## v0.9.0 [2020-03-04] Michael Granger <ged@FaerieMUD.org>
6
13
 
7
14
  Improvements:
@@ -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/repo.rb CHANGED
@@ -300,6 +300,13 @@ class Hglib::Repo
300
300
  end
301
301
 
302
302
 
303
+ ### Returns +true+ if the given +filename+ is a file tracked by Mercurial.
304
+ def tracked?( filename )
305
+ status = self.status( filename )
306
+ return status&.tracked?
307
+ end
308
+
309
+
303
310
  ### Returns +true+ if all of the changesets in the specified +revset+ (or the
304
311
  ### current changeset if no +revset+ is given) are in the public phase.
305
312
  def public?( revset=nil )
data/lib/hglib.rb CHANGED
@@ -11,7 +11,7 @@ module Hglib
11
11
 
12
12
 
13
13
  # Package version
14
- VERSION = '0.9.0'
14
+ VERSION = '0.10.0'
15
15
 
16
16
  # Version control revision
17
17
  REVISION = %q$Revision$
@@ -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.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hglib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -34,7 +34,7 @@ cert_chain:
34
34
  jBZSA+N+xUTgUWpXjjwsLZjzJkhWATJWq+krNXcqpwXo6HsjmdUxoFMt63RBb+sI
35
35
  XrxOxp8o0uOkU7FdLSGsyqJ2LzsR4obN
36
36
  -----END CERTIFICATE-----
37
- date: 2020-03-04 00:00:00.000000000 Z
37
+ date: 2020-04-02 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: loggability
@@ -107,7 +107,7 @@ dependencies:
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0.4'
109
109
  description: This is a client library for the Mercurial distributed revision control
110
- tool that uses the Command Server
110
+ tool that uses the Command Server for efficiency.
111
111
  email:
112
112
  - ged@FaerieMUD.org
113
113
  executables: []
@@ -171,5 +171,5 @@ rubygems_version: 3.1.2
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: This is a client library for the Mercurial distributed revision control tool
174
- that uses the Command Server
174
+ that uses the Command Server for efficiency.
175
175
  test_files: []
metadata.gz.sig CHANGED
Binary file