svn_command_helper 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/svn_command_helper/version.rb +1 -1
- data/lib/svn_command_helper.rb +34 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08e6ecccdfe2018f71d749bc767719708883b5b3
|
4
|
+
data.tar.gz: 2641caaef4a51f1642e4de3ae3978fbffe8c52ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a042a4d4246f38e2a7a0999ab118131608d94720c2c15d6b62c7775d1b2e2f8c29cae8d1460a97eb36266cf7424e3f913e0c8c9fa1cf82616496e07d4a5314e
|
7
|
+
data.tar.gz: a6dd2895b0cde7d0538c8e1fc5cda120aa6e465127fe45dbb9f838ee77eb4fef587f7d1fc0ee8e15341c0c177fce55b944da690f8bcdfe7efcf165a266d6ee71
|
data/lib/svn_command_helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require "svn_command_helper/version"
|
2
2
|
require 'pathname'
|
3
3
|
require 'yaml'
|
4
|
+
require 'time'
|
5
|
+
require 'ostruct'
|
6
|
+
require 'rexml/document'
|
4
7
|
require "system_command_helper"
|
5
8
|
|
6
9
|
# Subversion command helper
|
@@ -78,6 +81,37 @@ module SvnCommandHelper
|
|
78
81
|
sys "svn update #{depth ? "--set-depth #{depth}" : ""} #{path}"
|
79
82
|
end
|
80
83
|
|
84
|
+
# svn log
|
85
|
+
# @param [uri string like] uri target uri
|
86
|
+
# @param [Integer] limit --limit
|
87
|
+
# @param [Boolean] stop_on_copy --stop-on-copy
|
88
|
+
# @return [Array<OpenStruct>] log (old to new order)
|
89
|
+
def log(uri = ".", limit: nil, stop_on_copy: false)
|
90
|
+
log = cap "svn log --xml #{limit ? "--limit #{limit}" : ""} #{stop_on_copy ? "--stop-on-copy" : ""} #{uri}"
|
91
|
+
REXML::Document.new(log).elements.collect("/log/logentry") do |entry|
|
92
|
+
OpenStruct.new({
|
93
|
+
revision: entry.attribute("revision").value.to_i,
|
94
|
+
author: entry.elements["author"].text,
|
95
|
+
date: Time.iso8601(entry.elements["date"].text),
|
96
|
+
msg: entry.elements["msg"].text,
|
97
|
+
})
|
98
|
+
end.reverse
|
99
|
+
end
|
100
|
+
|
101
|
+
# head revision of uri
|
102
|
+
# @param [uri string like] uri target uri
|
103
|
+
# return [Integer] revision number
|
104
|
+
def revision(uri = ".")
|
105
|
+
log(uri, limit: 1).last.revision
|
106
|
+
end
|
107
|
+
|
108
|
+
# stop-on-copy revision of uri
|
109
|
+
# @param [uri string like] uri target uri
|
110
|
+
# return [Integer] revision number
|
111
|
+
def copied_revision(uri = ".")
|
112
|
+
log(uri, stop_on_copy: true).first.revision
|
113
|
+
end
|
114
|
+
|
81
115
|
# svn update to deep path recursive
|
82
116
|
# @param [path string like] path target path
|
83
117
|
# @param [depth] depth --set-depth for only new updated dirs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svn_command_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: system_command_helper
|