diff --git a/Vss2Git/GitExporter.cs b/Vss2Git/GitExporter.cs index 2193557..f17eda0 100755 --- a/Vss2Git/GitExporter.cs +++ b/Vss2Git/GitExporter.cs @@ -39,6 +39,7 @@ class GitExporter : Worker private readonly HashSet tagsUsed = new HashSet(); private bool ignoreErrors = false; private string defaultComment = ""; + private bool collapsePath = false; private string emailDomain = "localhost"; public string EmailDomain @@ -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) @@ -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); } diff --git a/Vss2Git/MainForm.Designer.cs b/Vss2Git/MainForm.Designer.cs index 803aa7f..f0a8ac0 100755 --- a/Vss2Git/MainForm.Designer.cs +++ b/Vss2Git/MainForm.Designer.cs @@ -52,6 +52,7 @@ private void InitializeComponent() this.commentLabel = new System.Windows.Forms.Label(); this.forceAnnotatedCheckBox = new System.Windows.Forms.CheckBox(); this.transcodeCheckBox = new System.Windows.Forms.CheckBox(); + this.collapsePathCheckBox = new System.Windows.Forms.CheckBox(); this.domainTextBox = new System.Windows.Forms.TextBox(); this.domainLabel = new System.Windows.Forms.Label(); this.outDirTextBox = new System.Windows.Forms.TextBox(); @@ -77,8 +78,8 @@ private void InitializeComponent() // // vssGroupBox // - this.vssGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.vssGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.vssGroupBox.Controls.Add(this.encodingLabel); this.vssGroupBox.Controls.Add(this.encodingComboBox); this.vssGroupBox.Controls.Add(this.excludeTextBox); @@ -105,8 +106,8 @@ private void InitializeComponent() // // encodingComboBox // - this.encodingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.encodingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.encodingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.encodingComboBox.FormattingEnabled = true; this.encodingComboBox.Location = new System.Drawing.Point(94, 97); @@ -116,8 +117,8 @@ private void InitializeComponent() // // excludeTextBox // - this.excludeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.excludeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.excludeTextBox.Location = new System.Drawing.Point(94, 71); this.excludeTextBox.Name = "excludeTextBox"; this.excludeTextBox.Size = new System.Drawing.Size(460, 20); @@ -134,8 +135,8 @@ private void InitializeComponent() // // vssProjectTextBox // - this.vssProjectTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.vssProjectTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.vssProjectTextBox.Location = new System.Drawing.Point(94, 45); this.vssProjectTextBox.Name = "vssProjectTextBox"; this.vssProjectTextBox.Size = new System.Drawing.Size(460, 20); @@ -143,8 +144,8 @@ private void InitializeComponent() // // vssDirTextBox // - this.vssDirTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.vssDirTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.vssDirTextBox.Location = new System.Drawing.Point(94, 19); this.vssDirTextBox.Name = "vssDirTextBox"; this.vssDirTextBox.Size = new System.Drawing.Size(460, 20); @@ -231,13 +232,14 @@ private void InitializeComponent() // // outputGroupBox // - this.outputGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.outputGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.outputGroupBox.Controls.Add(this.ignoreErrorsCheckBox); this.outputGroupBox.Controls.Add(this.commentTextBox); this.outputGroupBox.Controls.Add(this.commentLabel); this.outputGroupBox.Controls.Add(this.forceAnnotatedCheckBox); this.outputGroupBox.Controls.Add(this.transcodeCheckBox); + this.outputGroupBox.Controls.Add(this.collapsePathCheckBox); this.outputGroupBox.Controls.Add(this.domainTextBox); this.outputGroupBox.Controls.Add(this.domainLabel); this.outputGroupBox.Controls.Add(this.outDirTextBox); @@ -293,10 +295,20 @@ private void InitializeComponent() this.transcodeCheckBox.Text = "Transcode commit comments to UTF-8"; this.transcodeCheckBox.UseVisualStyleBackColor = true; // + // collapsePathCheckBox + // + this.collapsePathCheckBox.AutoSize = true; + this.collapsePathCheckBox.Location = new System.Drawing.Point(428, 123); + this.collapsePathCheckBox.Name = "collapsePathCheckBox"; + this.collapsePathCheckBox.Size = new System.Drawing.Size(148, 17); + this.collapsePathCheckBox.TabIndex = 8; + this.collapsePathCheckBox.Text = "Collapse VSS Path"; + this.collapsePathCheckBox.UseVisualStyleBackColor = true; + // // domainTextBox // - this.domainTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.domainTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.domainTextBox.Location = new System.Drawing.Point(94, 45); this.domainTextBox.Name = "domainTextBox"; this.domainTextBox.Size = new System.Drawing.Size(460, 20); @@ -313,8 +325,8 @@ private void InitializeComponent() // // outDirTextBox // - this.outDirTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.outDirTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.outDirTextBox.Location = new System.Drawing.Point(94, 19); this.outDirTextBox.Name = "outDirTextBox"; this.outDirTextBox.Size = new System.Drawing.Size(460, 20); @@ -331,8 +343,8 @@ private void InitializeComponent() // // logTextBox // - this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.logTextBox.Location = new System.Drawing.Point(94, 71); this.logTextBox.Name = "logTextBox"; this.logTextBox.Size = new System.Drawing.Size(460, 20); @@ -433,7 +445,7 @@ private void InitializeComponent() this.anyCommentUpDown.Name = "anyCommentUpDown"; this.anyCommentUpDown.Size = new System.Drawing.Size(54, 20); this.anyCommentUpDown.TabIndex = 1; - // + // // ignoreErrorsCheckBox // this.ignoreErrorsCheckBox.AutoSize = true; @@ -519,6 +531,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox ignoreErrorsCheckBox; private System.Windows.Forms.TextBox commentTextBox; private System.Windows.Forms.Label commentLabel; + private System.Windows.Forms.CheckBox collapsePathCheckBox; } } diff --git a/Vss2Git/MainForm.cs b/Vss2Git/MainForm.cs index 0310422..905a324 100755 --- a/Vss2Git/MainForm.cs +++ b/Vss2Git/MainForm.cs @@ -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; @@ -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); } @@ -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() @@ -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(); } } diff --git a/Vss2Git/Properties/Settings.Designer.cs b/Vss2Git/Properties/Settings.Designer.cs index cbaa44e..294a086 100755 --- a/Vss2Git/Properties/Settings.Designer.cs +++ b/Vss2Git/Properties/Settings.Designer.cs @@ -154,5 +154,17 @@ public string DefaultComment { this["DefaultComment"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool CollapsePath { + get { + return ((bool)(this["CollapsePath"])); + } + set { + this["CollapsePath"] = value; + } + } } } diff --git a/Vss2Git/Properties/Settings.settings b/Vss2Git/Properties/Settings.settings index 25b4af2..b1ffca2 100755 --- a/Vss2Git/Properties/Settings.settings +++ b/Vss2Git/Properties/Settings.settings @@ -33,7 +33,10 @@ True - + + + + False \ No newline at end of file diff --git a/Vss2Git/app.config b/Vss2Git/app.config index 5b0e845..1d649d6 100755 --- a/Vss2Git/app.config +++ b/Vss2Git/app.config @@ -8,16 +8,16 @@ - + $ - + - + localhost @@ -38,7 +38,10 @@ True - + + + + False