Fossil SCM

Contributing PowerShell script Set-ChildProject.ps1. This script wraps the code for converting a project into a child project into an easy to use PowerShell script. The script should be cross platform, but was only tested on Windows 10.

ckennedy 2019-08-09 20:15 trunk
Commit 0b70cf6d5758d7dac25b94565b01586140ab798f97b776e54e4464dccfd1a716
--- a/tools/Set-ChildProject.ps1
+++ b/tools/Set-ChildProject.ps1
@@ -0,0 +1,75 @@
1
+#!/usr/bin/env pwsh
2
+
3
+<#PSScriptInfo
4
+
5
+.VERSION 1.0.0
6
+
7
+.GUID 8c36fbf7-a306-4a88-85af-078fd9c91d0f
8
+
9
+.AUTHOR Chris Kennedy
10
+
11
+.COMPANYNAME Fossil-SCM.org
12
+
13
+.COPYRIGHT 2019
14
+
15
+.TAGS Fossil-SCM
16
+
17
+.LICENSEURI https://fossil-scm.org/fossil/doc/trunk/COPYRIGHT-BSD2.txt
18
+
19
+.PROJECTURI https://fossil-scm.org/fossil/doc/trunk/www/index.wiki
20
+
21
+.ICONURI
22
+
23
+.EXTERNALMODULEDEPENDENCIES
24
+
25
+.REQUIREDSCRIPTS
26
+
27
+.EXTERNALSCRIPTDEPENDENCIES
28
+
29
+.RELEASENOTES
30
+ 2019-08-09 CJK Initial release to Fossil-SCM Project.
31
+
32
+#>
33
+
34
+<#
35
+
36
+.Synopsis
37
+ Sets the current Fossil Repository to be a Child Project.
38
+
39
+.DESCRIPTION
40
+ Execute only in a current checkout. Should only be ran once after the
41
+ initial clone of the Child Project.
42
+
43
+ Use this when you clone a repository that you should not be pushing changes
44
+ to, such as when a repository is being used to provide a fully templated
45
+ project.
46
+
47
+.LINK
48
+ https://fossil-scm.org/fossil/doc/trunk/www/childprojects.wiki
49
+
50
+.INPUTS
51
+ None. You cannot pipe objects to Set-ChildProject.
52
+
53
+.OUTPUTS
54
+ None.
55
+
56
+.Parameter Name
57
+ Name of the Child Project.
58
+
59
+#>
60
+[CmdletBinding()]
61
+Param(
62
+ [Parameter(Mandatory=$true,Position=0)]
63
+ [ValidateNotNullOrEmpty()]
64
+ [string] $Name
65
+)
66
+
67
+$sql = @"
68
+UPDATE config SET name='parent-project-code' WHERE name='project-code';
69
+UPDATE config SET name='parent-project-name' WHERE name='project-name';
70
+INSERT INTO config(name,value) VALUES('project-code',lower(hex(randomblob(20))));
71
+INSERT INTO config(name,value) VALUES('project-name','$Name');
72
+"@
73
+
74
+$sql | fossil.exe sqlite3
75
+
--- a/tools/Set-ChildProject.ps1
+++ b/tools/Set-ChildProject.ps1
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/Set-ChildProject.ps1
+++ b/tools/Set-ChildProject.ps1
@@ -0,0 +1,75 @@
1 #!/usr/bin/env pwsh
2
3 <#PSScriptInfo
4
5 .VERSION 1.0.0
6
7 .GUID 8c36fbf7-a306-4a88-85af-078fd9c91d0f
8
9 .AUTHOR Chris Kennedy
10
11 .COMPANYNAME Fossil-SCM.org
12
13 .COPYRIGHT 2019
14
15 .TAGS Fossil-SCM
16
17 .LICENSEURI https://fossil-scm.org/fossil/doc/trunk/COPYRIGHT-BSD2.txt
18
19 .PROJECTURI https://fossil-scm.org/fossil/doc/trunk/www/index.wiki
20
21 .ICONURI
22
23 .EXTERNALMODULEDEPENDENCIES
24
25 .REQUIREDSCRIPTS
26
27 .EXTERNALSCRIPTDEPENDENCIES
28
29 .RELEASENOTES
30 2019-08-09 CJK Initial release to Fossil-SCM Project.
31
32 #>
33
34 <#
35
36 .Synopsis
37 Sets the current Fossil Repository to be a Child Project.
38
39 .DESCRIPTION
40 Execute only in a current checkout. Should only be ran once after the
41 initial clone of the Child Project.
42
43 Use this when you clone a repository that you should not be pushing changes
44 to, such as when a repository is being used to provide a fully templated
45 project.
46
47 .LINK
48 https://fossil-scm.org/fossil/doc/trunk/www/childprojects.wiki
49
50 .INPUTS
51 None. You cannot pipe objects to Set-ChildProject.
52
53 .OUTPUTS
54 None.
55
56 .Parameter Name
57 Name of the Child Project.
58
59 #>
60 [CmdletBinding()]
61 Param(
62 [Parameter(Mandatory=$true,Position=0)]
63 [ValidateNotNullOrEmpty()]
64 [string] $Name
65 )
66
67 $sql = @"
68 UPDATE config SET name='parent-project-code' WHERE name='project-code';
69 UPDATE config SET name='parent-project-name' WHERE name='project-name';
70 INSERT INTO config(name,value) VALUES('project-code',lower(hex(randomblob(20))));
71 INSERT INTO config(name,value) VALUES('project-name','$Name');
72 "@
73
74 $sql | fossil.exe sqlite3
75

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button