Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to collapse the VSS path in the output directory. #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Vss2Git/GitExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class GitExporter : Worker
private readonly HashSet<string> tagsUsed = new HashSet<string>();
private bool ignoreErrors = false;
private string defaultComment = "";
private bool collapsePath = false;

private string emailDomain = "localhost";
public string EmailDomain
Expand Down Expand Up @@ -73,6 +74,12 @@ public string DefaultComment
set { defaultComment = value; }
}

public bool CollapsePath
{
get { return collapsePath; }
set { collapsePath = value; }
}

public GitExporter(WorkQueue workQueue, Logger logger,
RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder)
: base(workQueue, logger)
Expand Down Expand Up @@ -131,7 +138,7 @@ public void ExportToGit(string repoPath)
// create mappings for root projects
foreach (var rootProject in revisionAnalyzer.RootProjects)
{
var rootPath = VssPathMapper.GetWorkingPath(repoPath, rootProject.Path);
var rootPath = collapsePath ? repoPath : VssPathMapper.GetWorkingPath(repoPath, rootProject.Path);
pathMapper.SetProjectPath(rootProject.PhysicalName, rootPath, rootProject.Path);
}

Expand Down
51 changes: 32 additions & 19 deletions Vss2Git/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Vss2Git/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ private void goButton_Click(object sender, EventArgs e)
transcodeCheckBox.Checked ? "enabled" : "disabled");
logger.WriteLine("Ignore errors: {0}",
ignoreErrorsCheckBox.Checked ? "enabled" : "disabled");
logger.WriteLine("Collapse VSS Path: {0}",
collapsePathCheckBox.Checked ? "enabled" : "disabled");

var df = new VssDatabaseFactory(vssDirTextBox.Text);
df.Encoding = encoding;
Expand Down Expand Up @@ -122,6 +124,7 @@ private void goButton_Click(object sender, EventArgs e)
gitExporter.CommitEncoding = encoding;
}
gitExporter.IgnoreErrors = ignoreErrorsCheckBox.Checked;
gitExporter.CollapsePath = collapsePathCheckBox.Checked;
gitExporter.ExportToGit(outDirTextBox.Text);
}

Expand Down Expand Up @@ -240,6 +243,7 @@ private void ReadSettings()
forceAnnotatedCheckBox.Checked = settings.ForceAnnotatedTags;
anyCommentUpDown.Value = settings.AnyCommentSeconds;
sameCommentUpDown.Value = settings.SameCommentSeconds;
collapsePathCheckBox.Checked = settings.CollapsePath;
}

private void WriteSettings()
Expand All @@ -255,6 +259,7 @@ private void WriteSettings()
settings.ForceAnnotatedTags = forceAnnotatedCheckBox.Checked;
settings.AnyCommentSeconds = (int)anyCommentUpDown.Value;
settings.SameCommentSeconds = (int)sameCommentUpDown.Value;
settings.CollapsePath = collapsePathCheckBox.Checked;
settings.Save();
}
}
Expand Down
12 changes: 12 additions & 0 deletions Vss2Git/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Vss2Git/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="DefaultComment" Type="System.String" Scope="User">
<Value Profile="(Default)"></Value>
<Value Profile="(Default)" />
</Setting>
<Setting Name="CollapsePath" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
11 changes: 7 additions & 4 deletions Vss2Git/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<userSettings>
<Hpdi.Vss2Git.Properties.Settings>
<setting name="VssDirectory" serializeAs="String">
<value/>
<value />
</setting>
<setting name="VssProject" serializeAs="String">
<value>$</value>
</setting>
<setting name="VssExcludePaths" serializeAs="String">
<value/>
<value />
</setting>
<setting name="GitDirectory" serializeAs="String">
<value/>
<value />
</setting>
<setting name="DefaultEmailDomain" serializeAs="String">
<value>localhost</value>
Expand All @@ -38,7 +38,10 @@
<value>True</value>
</setting>
<setting name="DefaultComment" serializeAs="String">
<value></value>
<value />
</setting>
<setting name="CollapsePath" serializeAs="String">
<value>False</value>
</setting>
</Hpdi.Vss2Git.Properties.Settings>
</userSettings>
Expand Down