将 SharpSVN 1.5 dll 替换为 SharpSVN 1.6 dll 的问题
我们使用 SharpSVN 1.5 dll 作为我们的源代码管理功能。 我们的签出和签入工作如下
假设我想签出一个名为 TEST 的文件夹,它包含 3 个文件,例如 file1.txt、file2.txt、file3.txt
第 1 步:- 从 SVN 存储库签出 file1.txt
步骤 2:- 从 SVN 存储库检出 file2.txt
步骤 3:- 从 SVN 存储库检出 file3.txt
在 file1.txt 检出操作期间,会在我们的工作文件夹中创建一个 .svn 文件夹。该 .svn 文件夹包含一个名为条目的文件。该文件包含 svn 存储库和签出文件信息(我们可以通过记事本打开它)。当发生 file2.txt 签出操作(签出到同一工作文件夹)时,不会创建新的 .svn 文件夹。 Sharpsvn 使用现有的 .svn 文件夹(以前的文件签出 .svn 文件夹)并将 file2.txt 信息附加到条目文件中。当将 file3.txt 签出到同一工作文件夹时,发生了同样的事情。
在签入操作期间,首先签入 file1.txt,然后签入 file2,然后签入 file3。 svn 使用单个 .svn 文件夹(在工作文件夹中)来签入所有这些文件。在 file1.txt 签入期间,entries 文件包含其信息,因此该文件受到 svn 版本控制,并且可以成功签入。与 file2 类似。 txt 和 file3.txt
现在我们尝试使用 SharpSVN 1.6 dll,但在签出和签入操作中遇到一些问题。
在 file1.txt 签出期间,创建 .svn 文件夹,条目文件包含 file1.txt 信息。在 file2.txt 签出期间,现有 .svn 文件夹被删除,并创建新的 .svn 文件夹。因此条目仅包含 file2.txt 信息,而不包含 file1。当我尝试签入时,我从 svn 签出的最后一个文件仅签入到 svn。这是因为 .svn 文件夹中的条目文件仅包含上次签出的文件信息。
我需要使用 Sharpsvn 1.6 dll 将所有文件信息放入条目文件
我的代码片段如下
public string[] CheckOut(string pSCPath, string pComment, string pLocalPath, int pRevisionNum)// Checks out a file from svn
{
string[] strCheckoutDetails = new string[2];
Uri uriSCPath = new Uri(pSCPath);
SvnCheckOutArgs objChkoutargs = new SvnCheckOutArgs();
objChkoutargs.Revision = pRevisionNum;
SvnInfoEventArgs info;
try
{
objChkoutargs.Depth = SvnDepth.Empty;
string strSingleFiletoCheckout = uriSCPath.ToString();
string strFolderNameofSingleFileSelected = strSingleFiletoCheckout.Remove(strSingleFiletoCheckout.LastIndexOf('/'));
Uri UriSingleFileCheckout = new Uri(strFolderNameofSingleFileSelected);
_objSVNClient.CheckOut(uriSingleFileCheckout, pLocalPath,objChkoutargs); //empty working folder
SvnTarget target = new Uri(strSingleFiletoCheckout);
string strFileNameonlyfromUri = strSingleFiletoCheckout.Substring(strSingleFiletoCheckout.LastIndexOf("/") + 1);
if (!copyFiletoWorkingCopy(pLocalPath, strFileNameonlyfromUri, _objSVNClient)) //make versioned file available to the current working copy - Biju
{
pLocalPath = "";
throw new SharpSvn.SvnException("Checkout Exception");
}
_objSVNClient.GetInfo(uriSCPath, out info);
strCheckoutDetails[0] = info.LastChangeRevision.ToString();
}
catch (Exception ex)
{
pLocalPath = "";
throw ex;
}
strCheckoutDetails[1] = pLocalPath;
return strCheckoutDetails;
}
谢谢
Reji
We are using SharpSVN 1.5 dll for our source control functionalites.
Our checkout and CheckIn works as follws
Suppose I want to checkout a folder name TEST and its contain 3 files say file1.txt,file2.txt,file3.txt
Step 1:- Checkout file1.txt from SVN repository
Step 2:- Checkout file2.txt from SVN repository
Step 3:- Checkout file3.txt from SVN repository
During file1.txt checkout operation a .svn folder is created in our working folder.This .svn folder contains a file named as entries. This file contains svn repository and checkout file info(We can see it open via notepad). When file2.txt checkout operation happened(Checkout to the same working folder) there is no new .svn folder creation happened. Sharpsvn uses existing .svn fiolder(previous file checkout .svn folder) and append the file2.txt info into entries file. Same thing happened when checkout file3.txt into same working folder.
During checkin operation first checkin file1.txt then file2 then file3. Svn uses the single .svn folder (in working folder)for all these files to checkin.During file1.txt check in ,entries file contains its info so this file comes under svn version control and it could successfuly checked in.Similar way file2.txt and file3.txt
Now we are trying to use SharpSVN 1.6 dll,but facing some issues in checkout and checkin operation.
During file1.txt checkout .svn folder is created and entries file contains file1.txt info.During file2.txt checkout, existing .svn foder is deleted and new .svn folder is created.So entries contains only file2.txt info not file1.txt info.When I am trying to checkin, the last file which I checked out from svn is only checked in to svn.This is because entries file in .svn folder contains only last checked out file info.
I need to get all file info into entries file using sharpsvn 1.6 dll
My code snippet as follows
public string[] CheckOut(string pSCPath, string pComment, string pLocalPath, int pRevisionNum)// Checks out a file from svn
{
string[] strCheckoutDetails = new string[2];
Uri uriSCPath = new Uri(pSCPath);
SvnCheckOutArgs objChkoutargs = new SvnCheckOutArgs();
objChkoutargs.Revision = pRevisionNum;
SvnInfoEventArgs info;
try
{
objChkoutargs.Depth = SvnDepth.Empty;
string strSingleFiletoCheckout = uriSCPath.ToString();
string strFolderNameofSingleFileSelected = strSingleFiletoCheckout.Remove(strSingleFiletoCheckout.LastIndexOf('/'));
Uri UriSingleFileCheckout = new Uri(strFolderNameofSingleFileSelected);
_objSVNClient.CheckOut(uriSingleFileCheckout, pLocalPath,objChkoutargs); //empty working folder
SvnTarget target = new Uri(strSingleFiletoCheckout);
string strFileNameonlyfromUri = strSingleFiletoCheckout.Substring(strSingleFiletoCheckout.LastIndexOf("/") + 1);
if (!copyFiletoWorkingCopy(pLocalPath, strFileNameonlyfromUri, _objSVNClient)) //make versioned file available to the current working copy - Biju
{
pLocalPath = "";
throw new SharpSvn.SvnException("Checkout Exception");
}
_objSVNClient.GetInfo(uriSCPath, out info);
strCheckoutDetails[0] = info.LastChangeRevision.ToString();
}
catch (Exception ex)
{
pLocalPath = "";
throw ex;
}
strCheckoutDetails[1] = pLocalPath;
return strCheckoutDetails;
}
Thanks
Reji
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Subversion 不支持直接检出文件。你可以做什么,并且在 Subversion / SharpSvn 1.6 中仍然有效的是:
这段示例代码检出一个空工作副本,并获取 file1.txt 和 file2.txt。如果您稍后以类似方式获取 file3.txt,则所有 3 个文件都在条目中,并且您可以对它们执行所有 Subversion 命令。
Checking out files directly is not supported in Subversion. What you can do, and what still works in Subversion / SharpSvn 1.6 is:
This piece of example code checks out an empty working copy, and fetches file1.txt and file2.txt. If you fetch file3.txt at a later point similarly, all 3 files are in entries, and you're able to execute all Subversion commands on them.