配置mercurial .hgingore忽略除'repositories.config'之外的目录中的所有文件和文件夹

时间:2013-12-09 15:31:26

标签: c# .net vb.net mercurial nuget

我有一个多项目解决方案,其目录结构如下所示

我想要的是忽略路径为library-management-system\packages的所有文件和文件夹。但是packages文件夹有一个名为repositories.config的文件,我不想被Mercurial忽略。

我该怎么做?

Folder PATH listing for volume PARIMAL
Volume serial number is 00650067 DD35:25E5
R:\LIBRARY-MANAGEMENT-SYSTEM
|   LibraryManagementSystem.sln
|   LibraryManagementSystem.sln.DotSettings.user
|   .hgignore
|   
+---CybotechDomain
|   |   App.config
|   |   CybotechDomain.csproj
|   |   CybotechDomain.csproj.user
|   |   
|   +---Entity
|   |       Batch.cs
|   |       Book.cs
|   |       BookIssue.cs
|   |       Course.cs
|   |       Faculty.cs
|   |       Manager.cs
|   |       Person.cs
|   |       Semester.cs
|   |       Student.cs
|   |       
|   +---Properties
|   |       AssemblyInfo.cs
|   |       
|   +---bin
|   |   \---Debug
|   |           CybotechDomain.dll.config
|   |           CybotechDomain.dll
|   |           CybotechDomain.pdb
|   |           
|   \---obj
|       \---Debug
|           |   DesignTimeResolveAssemblyReferencesInput.cache
|           |   CybotechDomain.pdb
|           |   CybotechDomain.dll
|           |   CybotechDomain.csproj.FileListAbsolute.txt
|           |   
|           \---TempPE
+---LibraryData
|   |   App.config
|   |   LibraryData.csproj
|   |   packages.config
|   |   
|   +---Data
|   |       BookRepository.cs
|   |       CourseRepository.cs
|   |       FacultyRepository.cs
|   |       IRepository.cs
|   |       IUnitOfWork.cs
|   |       LibraryContext.cs
|   |       LibraryInitializer.cs
|   |       LibraryUnitOfWork.cs
|   |       StudentRepository.cs
|   |       
|   +---Properties
|   |       AssemblyInfo.cs
|   |       
|   +---bin
|   |   \---Debug
|   |           CybotechDomain.dll
|   |           EntityFramework.dll
|   |           CybotechDomain.pdb
|   |           EntityFramework.xml
|   |           LibraryData.dll.config
|   |           LibraryData.dll
|   |           LibraryData.pdb
|   |           
|   \---obj
|       \---Debug
|           |   DesignTimeResolveAssemblyReferencesInput.cache
|           |   LibraryData.csprojResolveAssemblyReference.cache
|           |   LibraryData.pdb
|           |   LibraryData.dll
|           |   LibraryData.csproj.FileListAbsolute.txt
|           |   
|           \---TempPE
+---LibraryManager
|   |   LibraryManager.csproj
|   |   LibraryManager.csproj.DotSettings
|   |   Program.cs
|   |   app.config
|   |   packages.config
|   |   
|   +---Application
|   |       ApplicationModule.cs
|   |       Composition.cs
|   |       
|   +---Icons
|   |       books.ico
|   |       course.ico
|   |       
|   +---Images
|   |       add-16.png
|   |       add-24.png
|   |       book-32.png
|   |       book-48.png
|   |       book-issue.png
|   |       book-read.png
|   |       books.png
|   |       course.png
|   |       delete-16.png
|   |       delete-24.png
|   |       header.jpg
|   |       issue_book.png
|   |       lock-32.png
|   |       logo.PNG
|   |       orb.jpg
|   |       student-32.png
|   |       teacher-32.png
|   |       
|   +---Properties
|   |       AssemblyInfo.cs
|   |       Resources.Designer.cs
|   |       Resources.resx
|   |       Settings.Designer.cs
|   |       Settings.settings
|   |       
|   +---View
|   |       BookForm.Designer.cs
|   |       BookForm.cs
|   |       BookForm.resx
|   |       BookIssueForm.Designer.cs
|   |       BookIssueForm.cs
|   |       BookIssueForm.resx
|   |       BookListForm.Designer.cs
|   |       BookListForm.cs
|   |       BookListForm.resx
|   |       CourseForm.Designer.cs
|   |       CourseForm.cs
|   |       CourseForm.resx
|   |       Extensions.cs
|   |       FacultyAddForm.Designer.cs
|   |       FacultyAddForm.cs
|   |       FacultyAddForm.resx
|   |       InputBox.cs
|   |       InputForm.Designer.cs
|   |       InputForm.cs
|   |       InputForm.resx
|   |       LoginForm.Designer.cs
|   |       LoginForm.cs
|   |       LoginForm.resx
|   |       MainForm.Designer.cs
|   |       MainForm.cs
|   |       MainForm.resx
|   |       OfficeFormWithStatus.cs
|   |       StudentAddForm.Designer.cs
|   |       StudentAddForm.cs
|   |       StudentAddForm.resx
|   |       
|   +---bin
|   |   \---Debug
|   |       |   LibraryManager.vshost.exe.config
|   |       |   LibraryManager.vshost.exe.manifest
|   |       |   LibraryManager.vshost.exe
|   |       |   CybotechDomain.dll
|   |       |   EntityFramework.dll
|   |       |   Equin.ApplicationFramework.BindingListView.dll
|   |       |   LibraryData.dll
|   |       |   Ninject.dll
|   |       |   System.Data.SqlServerCe.dll
|   |       |   CybotechDomain.pdb
|   |       |   LibraryData.pdb
|   |       |   EntityFramework.xml
|   |       |   Equin.ApplicationFramework.BindingListView.pdb
|   |       |   Ninject.pdb
|   |       |   Ninject.xml
|   |       |   LibraryManager.exe.config
|   |       |   LibraryManager.exe
|   |       |   LibraryManager.pdb
|   |       |   
|   |       +---x86
|   |       |   |   sqlceca40.dll
|   |       |   |   sqlcecompact40.dll
|   |       |   |   sqlceer40EN.dll
|   |       |   |   sqlceme40.dll
|   |       |   |   sqlceqp40.dll
|   |       |   |   sqlcese40.dll
|   |       |   |   
|   |       |   \---Microsoft.VC90.CRT
|   |       |           Microsoft.VC90.CRT.manifest
|   |       |           msvcr90.dll
|   |       |           README_ENU.txt
|   |       |           
|   |       \---amd64
|   |           |   sqlceca40.dll
|   |           |   sqlcecompact40.dll
|   |           |   sqlceer40EN.dll
|   |           |   sqlceme40.dll
|   |           |   sqlceqp40.dll
|   |           |   sqlcese40.dll
|   |           |   
|   |           \---Microsoft.VC90.CRT
|   |                   Microsoft.VC90.CRT.manifest
|   |                   msvcr90.dll
|   |                   README_ENU.txt
|   |                   
|   \---obj
|       \---x86
|           \---Debug
|               |   DesignTimeResolveAssemblyReferencesInput.cache
|               |   LibraryManager.csproj.FileListAbsolute.txt
|               |   DesignTimeResolveAssemblyReferences.cache
|               |   LibraryManager.csprojResolveAssemblyReference.cache
|               |   Cybotech.Properties.Resources.resources
|               |   Cybotech.View.BookForm.resources
|               |   Cybotech.View.BookIssueForm.resources
|               |   Cybotech.View.BookListForm.resources
|               |   Cybotech.View.CourseForm.resources
|               |   Cybotech.View.FacultyAddForm.resources
|               |   Cybotech.View.InputForm.resources
|               |   Cybotech.View.LoginForm.resources
|               |   Cybotech.View.MainForm.resources
|               |   Cybotech.View.StudentAddForm.resources
|               |   LibraryManager.csproj.GenerateResource.Cache
|               |   LibraryManager.pdb
|               |   LibraryManager.exe
|               |   
|               \---TempPE
|                       Properties.Resources.Designer.cs.dll
|                       
+---LibraryTest
|   |   App.config
|   |   LibraryTest.csproj
|   |   LibraryTester.cs
|   |   packages.config
|   |   
|   +---Properties
|   |       AssemblyInfo.cs
|   |       
|   +---bin
|   |   \---Debug
|   |           CybotechDomain.dll
|   |           EntityFramework.dll
|   |           LibraryData.dll
|   |           CybotechDomain.pdb
|   |           LibraryData.pdb
|   |           EntityFramework.xml
|   |           LibraryTest.dll.config
|   |           LibraryTest.dll
|   |           LibraryTest.pdb
|   |           
|   \---obj
|       \---Debug
|           |   DesignTimeResolveAssemblyReferencesInput.cache
|           |   LibraryTest.csprojResolveAssemblyReference.cache
|           |   LibraryTest.pdb
|           |   LibraryTest.dll
|           |   LibraryTest.csproj.FileListAbsolute.txt
|           |   
|           \---TempPE
+---packages
|   |   repositories.config
|   |   
|   +---EntityFramework.4.3.1
|   |   |   EntityFramework.4.3.1.nuspec
|   |   |   EntityFramework.4.3.1.nupkg
|   |   |   
|   |   +---Content
|   |   |       App.config.transform
|   |   |       Web.config.transform
|   |   |       
|   |   +---lib
|   |   |   \---net40
|   |   |           EntityFramework.dll
|   |   |           EntityFramework.xml
|   |   |           
|   |   \---tools
|   |           EF4.3on.NET4.5Readme.txt
|   |           EntityFramework.PowerShell.dll
|   |           EntityFramework.psd1
|   |           EntityFramework.psm1
|   |           init.ps1
|   |           install.ps1
|   |           migrate.exe
|   |           
|   +---Ninject.3.0.1.10
|   |   |   Ninject.3.0.1.10.nuspec
|   |   |   Ninject.3.0.1.10.nupkg
|   |   |   
|   |   \---lib
|   |       +---net35
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---net40
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---net45-full
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---sl2
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---sl3-wp
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---sl3
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---sl4-windowsphone71
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       +---sl4
|   |       |       Ninject.dll
|   |       |       Ninject.pdb
|   |       |       Ninject.xml
|   |       |       
|   |       \---sl5
|   |               Ninject.dll
|   |               Ninject.pdb
|   |               Ninject.xml
|   |               
|   +---Microsoft.SqlServer.Compact.4.0.8876.1
|   |   |   SQLCE_EULA_ENU.rtf
|   |   |   Microsoft.SqlServer.Compact.4.0.8876.1.nuspec
|   |   |   Microsoft.SqlServer.Compact.4.0.8876.1.nupkg
|   |   |   
|   |   +---Content
|   |   |       web.config.transform
|   |   |       
|   |   +---lib
|   |   |   \---net40
|   |   |           System.Data.SqlServerCe.dll
|   |   |           
|   |   +---NativeBinaries
|   |   |   +---amd64
|   |   |   |   |   sqlceca40.dll
|   |   |   |   |   sqlcecompact40.dll
|   |   |   |   |   sqlceer40EN.dll
|   |   |   |   |   sqlceme40.dll
|   |   |   |   |   sqlceqp40.dll
|   |   |   |   |   sqlcese40.dll
|   |   |   |   |   
|   |   |   |   \---Microsoft.VC90.CRT
|   |   |   |           Microsoft.VC90.CRT.manifest
|   |   |   |           msvcr90.dll
|   |   |   |           README_ENU.txt
|   |   |   |           
|   |   |   \---x86
|   |   |       |   sqlceca40.dll
|   |   |       |   sqlcecompact40.dll
|   |   |       |   sqlceer40EN.dll
|   |   |       |   sqlceme40.dll
|   |   |       |   sqlceqp40.dll
|   |   |       |   sqlcese40.dll
|   |   |       |   
|   |   |       \---Microsoft.VC90.CRT
|   |   |               Microsoft.VC90.CRT.manifest
|   |   |               msvcr90.dll
|   |   |               README_ENU.txt
|   |   |               
|   |   \---tools
|   |           Install.ps1
|   |           Uninstall.ps1
|   |           VS.psd1
|   |           VS.psm1
|   |           
|   \---Unofficial.BindingListView.1.2.0.0
|       |   Unofficial.BindingListView.1.2.0.0.nuspec
|       |   Unofficial.BindingListView.1.2.0.0.nupkg
|       |   
|       \---lib
|           \---net20
|                   Equin.ApplicationFramework.BindingListView.dll
|                   Equin.ApplicationFramework.BindingListView.pdb
|                   
+---.hg
|   |   00changelog.i
|   |   requires
|   |   hgrc
|   |   cur-message.txt
|   |   
|   \---store
\---.nuget
        NuGet.targets
        NuGet.exe
        NuGet.Config

3 个答案:

答案 0 :(得分:4)

.hgignore不会影响已添加到存储库的文件,因此最简单的方法是忽略文件夹并手动添加包\ repositories.config 文件。

答案 1 :(得分:1)

在.hgignore中使用前瞻性regexp条目

syntax: regexp
^library-management-system/packages/(?!repositories\.config).+$

答案 2 :(得分:0)

该文件夹是否恰好是NuGet包文件夹?在这种情况下,您可以告诉NuGet本身忽略该文件夹,但配置文件除外:http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages

当然,这仅适用于使用集成到Visual Studio中的版本控制系统。