git-ds 0.9.7.5 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +3 -0
- data/lib/git-ds/index.rb +6 -0
- data/lib/git-ds/model.rb +33 -0
- metadata +4 -5
data/ChangeLog
CHANGED
data/lib/git-ds/index.rb
CHANGED
data/lib/git-ds/model.rb
CHANGED
@@ -133,6 +133,39 @@ See Database#branch_and_merge.
|
|
133
133
|
@db.branch_and_merge(name, &block)
|
134
134
|
end
|
135
135
|
|
136
|
+
=begin
|
137
|
+
Execute a block using an in-memory Staging index.
|
138
|
+
|
139
|
+
This is an optimization. It writes the current index to the git staging index
|
140
|
+
on disk, replaces it with an in-memory index that DOES NOT write to the object
|
141
|
+
tree on disk, invokes the block, writes the in-memory index to the git staging
|
142
|
+
index on disk, then reads the staging index into the repo/database and makes
|
143
|
+
it the current index.
|
144
|
+
|
145
|
+
The idea is to reduce disk writes caused by exec and transaction, which can
|
146
|
+
end up being very costly when nested.
|
147
|
+
|
148
|
+
NOTE: branch-and-merge will fail if in batch mode.
|
149
|
+
=end
|
150
|
+
def batch(&block)
|
151
|
+
# write current index to git-staging-index
|
152
|
+
idx = (@db.staging?) ? @db.staging : nil
|
153
|
+
idx.sync if idx
|
154
|
+
|
155
|
+
# replace current index with an in-mem staging index
|
156
|
+
@db.unstage
|
157
|
+
@db.staging=StageMemIndex.read(@db)
|
158
|
+
|
159
|
+
yield @db.staging if block_given?
|
160
|
+
|
161
|
+
# write in-mem staging index to git-staging-index
|
162
|
+
@db.staging.sync
|
163
|
+
|
164
|
+
# read git-staging-index if appropriate
|
165
|
+
@db.unstage
|
166
|
+
@db.staging if idx
|
167
|
+
end
|
168
|
+
|
136
169
|
end
|
137
170
|
|
138
171
|
=begin rdoc
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-ds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.9.7.5
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- TG Community
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-26 00:00:00 -04:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|