Skip to content

Commit 9a18f3f

Browse files
authored
Comment out the logic of geting gallery version. (#12144)
* Comment out the logic of get gallery version. * Fix the variable defined but not used. Co-authored-by: wyunchi <[email protected]>
1 parent 3d8b020 commit 9a18f3f

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

tools/VersionController/Models/VersionBumper.cs

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ public void BumpAllVersions()
7878
public Tuple<string, bool> GetOldVersion()
7979
{
8080
string version;
81-
string localVersion = null, psVersion = null, testVersion = null;
81+
string localVersion = null;
82+
// string localVersion = null, psVersion = null, testVersion = null;
8283
bool isPreview;
83-
bool localPreview = false, psPreview = false, testPreview = false;
84+
bool localPreview = false;
85+
// bool localPreview = false, psPreview = false, testPreview = false;
8486
var moduleName = _fileHelper.ModuleName;
8587

8688
using (PowerShell powershell = PowerShell.Create())
@@ -98,53 +100,53 @@ public Tuple<string, bool> GetOldVersion()
98100
version = localVersion;
99101
isPreview = localPreview;
100102

101-
using (PowerShell powetshell = PowerShell.Create())
102-
{
103-
powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
104-
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
105-
var cmdletResult = powetshell.Invoke();
106-
if (cmdletResult.Count != 0)
107-
{
108-
var psVersionImformation = cmdletResult[0].ToString();
109-
Regex reg = new Regex("Version=(.*?)(-|;)");
110-
Match match = reg.Match(psVersionImformation);
111-
psVersion = match.Groups[1].Value;
112-
psPreview = Regex.IsMatch(psVersionImformation, "preview");
113-
}
114-
}
115-
if (psVersion == null)
116-
{
117-
psVersion = "0.1.0";
118-
}
119-
if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
120-
{
121-
version = psVersion;
122-
isPreview = psPreview;
123-
}
124-
125-
using (PowerShell powetshell = PowerShell.Create())
126-
{
127-
powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
128-
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
129-
var cmdletResult = powetshell.Invoke();
130-
if (cmdletResult.Count != 0)
131-
{
132-
var testVersionImformation = cmdletResult[0].ToString();
133-
Regex reg = new Regex("Version=(.*?)(-|;)");
134-
Match match = reg.Match(testVersionImformation);
135-
testVersion = match.Groups[1].Value;
136-
testPreview = Regex.IsMatch(testVersionImformation, "preview");
137-
}
138-
}
139-
if (testVersion == null)
140-
{
141-
testVersion = "0.1.0";
142-
}
143-
if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
144-
{
145-
version = testVersion;
146-
isPreview = testPreview;
147-
}
103+
// using (PowerShell powetshell = PowerShell.Create())
104+
// {
105+
// powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
106+
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
107+
// var cmdletResult = powetshell.Invoke();
108+
// if (cmdletResult.Count != 0)
109+
// {
110+
// var psVersionImformation = cmdletResult[0].ToString();
111+
// Regex reg = new Regex("Version=(.*?)(-|;)");
112+
// Match match = reg.Match(psVersionImformation);
113+
// psVersion = match.Groups[1].Value;
114+
// psPreview = Regex.IsMatch(psVersionImformation, "preview");
115+
// }
116+
// }
117+
// if (psVersion == null)
118+
// {
119+
// psVersion = "0.1.0";
120+
// }
121+
// if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
122+
// {
123+
// version = psVersion;
124+
// isPreview = psPreview;
125+
// }
126+
127+
// using (PowerShell powetshell = PowerShell.Create())
128+
// {
129+
// powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
130+
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
131+
// var cmdletResult = powetshell.Invoke();
132+
// if (cmdletResult.Count != 0)
133+
// {
134+
// var testVersionImformation = cmdletResult[0].ToString();
135+
// Regex reg = new Regex("Version=(.*?)(-|;)");
136+
// Match match = reg.Match(testVersionImformation);
137+
// testVersion = match.Groups[1].Value;
138+
// testPreview = Regex.IsMatch(testVersionImformation, "preview");
139+
// }
140+
// }
141+
// if (testVersion == null)
142+
// {
143+
// testVersion = "0.1.0";
144+
// }
145+
// if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
146+
// {
147+
// version = testVersion;
148+
// isPreview = testPreview;
149+
// }
148150

149151
return Tuple.Create(version, isPreview);
150152
}

0 commit comments

Comments
 (0)