在Subversion中保留文件创建日期

时间:2021-07-09 03:43:18

My boss asked me to setup a Subversion server for him to use so that he can share all his documents across different machines in sync and still be able to access them when there is no Internet connection.

我的老板让我设置一个Subversion服务器供他使用,以便他可以在不同的机器上同步共享他的所有文件,并且在没有互联网连接时仍能访问它们。

I have this up for him, but now he's requesting that the 'create date' file attribute be preserved. I explained that since he downloaded all the files that is their create date, but he insists I find a manner to preserve this as it is affecting the desktop search agent he uses. Is there any way to set this attribute to be preserved via Subversion, or do I have to write a script to get the date of each file and have him run 'touch' after each intial check out?

我为他做了这件事,但现在他要求保留'创建日期'文件属性。我解释说,因为他下载了所有创建日期的文件,但他坚持认为我找到了一种方法来保留它,因为它影响了他使用的桌面搜索代理。有没有办法设置这个属性通过Subversion保存,或者我是否必须编写一个脚本来获取每个文件的日期并让他在每次初始结账后运行'touch'?

Note that the set of documents that were added to the SVN repository span back several years, and he wants these dates preserved across all checkouts. So the date of the last change that Subversion has could potentially be off by years from what he wants.

请注意,添加到SVN存储库的文档集可以追溯到几年,他希望在所有签出中保留这些日期。因此,Subversion最后一次更改的日期可能会远离他想要的数年。

5 个解决方案

#1


3  

Sorry - misunderstood the question first time.

对不起 - 第一次误解了这个问题。

One option might be to use the svnadmin dump and load commands.

一种选择可能是使用svnadmin dump和load命令。

  • Dump the repository using svnadmin dump.
  • 使用svnadmin dump转储存储库。

  • Write a script to trawl through the output, updating the SVN create date to the file create date on your source folder.
  • 编写脚本以通过输出进行拖动,将SVN创建日期更新为源文件夹上的文件创建日期。

  • Load the updated dump file back in using svnadmin load.
  • 使用svnadmin load重新加载更新的转储文件。

  • Use the Set file dates to the "last commit time" setting I suggested earlier.
  • 使用设置文件日期到我之前建议的“上次提交时间”设置。

I'm not certain this is possible, but off the top of my head I think it would be. I seem to remember a script which did something like this when I transferred from SourceSafe to Subversion - I'll see if I can find it.

我不确定这是可能的,但我认为这是可能的。我似乎记得一个脚本,当我从SourceSafe转移到Subversion时做了类似的事情 - 我会看看我是否能找到它。

EDIT : Yeah, you might be able to crib some code from here (http://www.pumacode.org/projects/vss2svn)

编辑:是的,你可以从这里获取一些代码(http://www.pumacode.org/projects/vss2svn)

#2


5  

Using TortoiseSVN

  • Right-click and select TortoiseSVN -> Settings
  • 右键单击并选择TortoiseSVN - >设置

  • Select Set file dates to the "last commit time"
  • 选择将文件日期设置为“上次提交时间”

I think that will work for you.

我认为这对你有用。

#3


1  

Check out the property "svn:date":

查看酒店“svn:date”:

svn propset svn:date --revprop -r HEAD "2007-04-22"

Which requires a hook pre-revprop-change to be set up in advance.

这需要提前设置挂钩预转换。

#4


0  

You could use a Subversion file property to store the modification date, but you'd have to write your own script to update the property when checking in and to set the modification date when checking out.

您可以使用Subversion文件属性来存储修改日期,但是您必须编写自己的脚本以在签入时更新属性并在签出时设置修改日期。

#5


0  

The last time I checked there was no way in Subversion to preserve the original file's timestamp.

我最后一次检查时,Subversion无法保留原始文件的时间戳。

#1


3  

Sorry - misunderstood the question first time.

对不起 - 第一次误解了这个问题。

One option might be to use the svnadmin dump and load commands.

一种选择可能是使用svnadmin dump和load命令。

  • Dump the repository using svnadmin dump.
  • 使用svnadmin dump转储存储库。

  • Write a script to trawl through the output, updating the SVN create date to the file create date on your source folder.
  • 编写脚本以通过输出进行拖动,将SVN创建日期更新为源文件夹上的文件创建日期。

  • Load the updated dump file back in using svnadmin load.
  • 使用svnadmin load重新加载更新的转储文件。

  • Use the Set file dates to the "last commit time" setting I suggested earlier.
  • 使用设置文件日期到我之前建议的“上次提交时间”设置。

I'm not certain this is possible, but off the top of my head I think it would be. I seem to remember a script which did something like this when I transferred from SourceSafe to Subversion - I'll see if I can find it.

我不确定这是可能的,但我认为这是可能的。我似乎记得一个脚本,当我从SourceSafe转移到Subversion时做了类似的事情 - 我会看看我是否能找到它。

EDIT : Yeah, you might be able to crib some code from here (http://www.pumacode.org/projects/vss2svn)

编辑:是的,你可以从这里获取一些代码(http://www.pumacode.org/projects/vss2svn)

#2


5  

Using TortoiseSVN

  • Right-click and select TortoiseSVN -> Settings
  • 右键单击并选择TortoiseSVN - >设置

  • Select Set file dates to the "last commit time"
  • 选择将文件日期设置为“上次提交时间”

I think that will work for you.

我认为这对你有用。

#3


1  

Check out the property "svn:date":

查看酒店“svn:date”:

svn propset svn:date --revprop -r HEAD "2007-04-22"

Which requires a hook pre-revprop-change to be set up in advance.

这需要提前设置挂钩预转换。

#4


0  

You could use a Subversion file property to store the modification date, but you'd have to write your own script to update the property when checking in and to set the modification date when checking out.

您可以使用Subversion文件属性来存储修改日期,但是您必须编写自己的脚本以在签入时更新属性并在签出时设置修改日期。

#5


0  

The last time I checked there was no way in Subversion to preserve the original file's timestamp.

我最后一次检查时,Subversion无法保留原始文件的时间戳。