takeltau 0.36.1 → 0.37.1

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: 401a6ec84063daaad2d0b2ba91232b5d3f0322a2675ecc61eef9998d22867378
4
- data.tar.gz: c79e35f420922cd660ea5e80504f6cb909b4387aedefa7fffeb3db97c6d4c847
3
+ metadata.gz: 293a71b537a49394f198b0a1479285f57e43d899ccaffdcf64f18e91a95a4445
4
+ data.tar.gz: 00e04f3a868ac61e81660b4e37e74a83d055c72d591ca53be88e04c48b32e488
5
5
  SHA512:
6
- metadata.gz: ff29b7c25e3955263a0bd1d0fa74f1ee5e43af8759d1d6daf3680084659aaae8c9610976e73524eea1d875738b161b2abaa7e9a0bff1c478dc33ddf945cd6b1a
7
- data.tar.gz: 7e5fc47759b9488e4f18019cce0eaf2221864ba7a08b8ab70dc3279eaa2f975a64f7e93130f305256c4f8a868f8960fed27d96a1940b436098af3c151afb6623
6
+ metadata.gz: 4f259593b1df8171bcd2400ba152a55c430b3c535e8c8f5abe6cbc3e66c4484947e32472d0ff612e848f0429ee96424306329f0a7abc063f116c9610396fb628
7
+ data.tar.gz: b71b36fcba29683483fa39e35e46293dac09c61c6b1603977605ab0eacf16eefe12867058160544ac21774b05a0f34b95c24baf7b915c18530a60cebb3fe3dcc
data/README.md CHANGED
@@ -168,7 +168,21 @@ to overwrite defaults like:
168
168
  docker_repo: takelage-mock
169
169
  ```
170
170
 
171
- Furthermore, every external command can be reconfigured.
171
+ - You may prefer to interact with
172
+ [mercurial](https://github.com/takelwerk/takelage-doc/blob/main/doc/tau/hg.md)
173
+ through `tau hg`
174
+ in a different branch than `main` in one project so you may add
175
+ to your *takelage.yml*:
176
+
177
+
178
+ ```yaml
179
+ ---
180
+ git_hg_repo: my_git_hg_branch
181
+ ```
182
+
183
+ Furthermore,
184
+ [every external command](https://github.com/takelwerk/takelage-cli/blob/main/lib/takeltau/default.yml)
185
+ can be reconfigured.
172
186
 
173
187
  ### Project Files
174
188
 
@@ -23,13 +23,13 @@ cmd_git_check_clean_git_status: 'git status --porcelain'
23
23
  cmd_git_check_hg_get_git_branch: 'git symbolic-ref HEAD'
24
24
  cmd_git_check_workspace_git_repo: 'git -C %{dir} rev-parse'
25
25
  cmd_git_check_workspace_pwd: 'pwd'
26
- cmd_git_lib_git_add_all: 'git add --all'
26
+ cmd_git_lib_git_add_hg_dirs: 'git add \*/.hg/\*'
27
27
  cmd_git_lib_git_commit: 'git commit --message="%{message}"'
28
28
  cmd_git_lib_git_pull_origin: 'git pull origin %{main}'
29
29
  cmd_git_lib_git_push_origin: 'git push origin %{main}'
30
- cmd_hg_list_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k hg paths default -R {//} -T "hg\ clone\ {url}\ " \; echo {//}'
31
- cmd_hg_pull_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k echo \; cd {//} \; pwd \; hg pull --update'
32
- cmd_hg_push_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k echo \; cd {//} \; pwd \; hg commit --addremove --message "Update\ hg\ repos" \; hg bookmark -f main \; hg push'
30
+ cmd_hg_list_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order hg paths default --repository {//} --template "hg\ clone\ {url}\ " \; echo {//}'
31
+ cmd_hg_pull_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order echo \; cd {//} \; pwd \; hg pull --update'
32
+ cmd_hg_push_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order echo \; cd {//} \; pwd \; hg commit --addremove --message "Update\ hg\ repos" \; hg bookmarks --force main \; hg push'
33
33
  cmd_info_status_lib_git_name: 'git -C %{root} config user.name'
34
34
  cmd_info_status_lib_git_email: 'git -C %{root} config user.email'
35
35
  cmd_info_status_lib_git_signingkey: 'git -C %{root} config user.signingKey'
@@ -2,35 +2,56 @@
2
2
 
3
3
  # tau git lib
4
4
  module GitLib
5
- # Pull git workspace.
6
- def git_lib_pull_workspace
7
- log.info 'Pulling git workspace'
5
+ # Prepare git workspace.
6
+ # rubocop:disable Metrics/MethodLength
7
+ def git_lib_prepare_git_workspace
8
+ log.debug 'Prepare git workspace'
8
9
 
9
- _git_lib_git_pull_origin_hg
10
+ return false unless configured? %w[project_root_dir]
11
+
12
+ unless git_check_hg
13
+ log.error 'Not on git hg branch'
14
+ return false
15
+ end
16
+
17
+ unless git_check_clean
18
+ log.error 'No clean git workspace'
19
+ return false
20
+ end
21
+
22
+ return true if _git_lib_git_pull_origin_hg
23
+
24
+ log.error 'Unable to pull git workspace'
25
+ false
10
26
  end
27
+ # rubocop:enable Metrics/MethodLength
11
28
 
12
29
  # Push git workspace.
13
- def git_lib_push_workspace(message)
30
+ def git_lib_push_hg_dirs
14
31
  log.info 'Pushing git workspace'
15
32
 
16
- return false unless _git_lib_git_add_all
33
+ message = 'Update .hg mercurial directories'
34
+
35
+ return false unless _git_lib_git_add_hg_dirs
17
36
  return false unless _git_lib_git_commit message
18
- return false unless _git_lib_git_pull_origin_hg
19
37
 
20
- _git_lib_git_push_origin_hg
38
+ return true if _git_lib_git_push_origin_hg
39
+
40
+ log.error 'Unable to git push .hg mercurial directories'
41
+ false
21
42
  end
22
43
 
23
44
  private
24
45
 
25
- # git add all.
26
- def _git_lib_git_add_all
27
- log.debug 'Adding all files to git'
46
+ # git add hg dirs.
47
+ def _git_lib_git_add_hg_dirs
48
+ log.debug 'Adding all .hg mercurial dirs to git'
28
49
 
29
- cmd_git_add_all = config.active['cmd_git_lib_git_add_all']
50
+ cmd_git_add_hg_dirs = config.active['cmd_git_lib_git_add_hg_dirs']
30
51
 
31
- return true if try cmd_git_add_all
52
+ return true if (try cmd_git_add_hg_dirs).exitstatus.zero?
32
53
 
33
- log.error 'Unable to add all files to git'
54
+ log.error 'Unable to add all .hg mercurial dirs to git'
34
55
  false
35
56
  end
36
57
 
@@ -43,7 +64,7 @@ module GitLib
43
64
  message: message
44
65
  )
45
66
 
46
- return true if try cmd_git_commit
67
+ return true if (try cmd_git_commit).exitstatus.zero?
47
68
 
48
69
  log.error 'Unable to commit to git'
49
70
  false
@@ -3,31 +3,18 @@
3
3
  # tau hg pull
4
4
  module HgPull
5
5
  # Backend method for hg pull.
6
- # rubocop:disable Metrics/MethodLength
7
6
  def hg_pull
8
7
  log.debug 'Pull hg repos'
9
8
 
10
- return false unless configured? %w[project_root_dir]
9
+ return false unless git_lib_prepare_git_workspace
11
10
 
12
- unless git_check_hg
13
- log.error 'Not on git hg branch'
11
+ unless _hg_pull_hg_pull_repos
12
+ log.error 'Unable to tau hg pull'
14
13
  return false
15
14
  end
16
15
 
17
- unless git_check_clean
18
- log.error 'No clean git workspace'
19
- return false
20
- end
21
-
22
- unless git_lib_pull_workspace
23
- log.error 'Unable to pull git workspace'
24
- return false
25
- end
26
-
27
- log.info _hg_pull_hg_pull_repos
28
- true
16
+ git_lib_push_hg_dirs
29
17
  end
30
- # rubocop:enable Metrics/MethodLength
31
18
 
32
19
  private
33
20
 
@@ -38,6 +25,8 @@ module HgPull
38
25
  root: config.active['project_root_dir']
39
26
  )
40
27
 
41
- run cmd_hg_pull_repos
28
+ stdout, _, exitstatus = run_and_capture cmd_hg_pull_repos
29
+ log.info stdout
30
+ exitstatus.zero?
42
31
  end
43
32
  end
@@ -3,30 +3,18 @@
3
3
  # tau hg push
4
4
  module HgPush
5
5
  # Backend method for hg push.
6
- # rubocop:disable Metrics/MethodLength
7
6
  def hg_push
8
7
  log.debug 'Push hg repos'
9
8
 
10
- return false unless configured? %w[project_root_dir]
9
+ return false unless git_lib_prepare_git_workspace
11
10
 
12
- unless git_check_hg
13
- log.error 'Not on git hg branch'
11
+ unless _hg_push_hg_push_repos
12
+ log.error 'Unable to tau hg push'
14
13
  return false
15
14
  end
16
15
 
17
- unless git_check_clean
18
- log.error 'No clean git workspace'
19
- return false
20
- end
21
-
22
- log.info _hg_push_hg_push_repos
23
-
24
- return true if git_lib_push_workspace 'tau hg push'
25
-
26
- log.error 'Unable to push git workspace'
27
- false
16
+ git_lib_push_hg_dirs
28
17
  end
29
- # rubocop:enable Metrics/MethodLength
30
18
 
31
19
  private
32
20
 
@@ -37,6 +25,8 @@ module HgPush
37
25
  root: config.active['project_root_dir']
38
26
  )
39
27
 
40
- run cmd_hg_push_repos
28
+ stdout, _, exitstatus = run_and_capture cmd_hg_push_repos
29
+ log.info stdout
30
+ exitstatus.zero?
41
31
  end
42
32
  end
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.36.1
1
+ 0.37.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeltau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.1
4
+ version: 0.37.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk