【问题标题】:one-way symbolic link from repository to build directory从存储库到构建目录的单向符号链接
【发布时间】:2011-12-19 23:41:46
【问题描述】:

我正在 svn 存储库中编写代码,但我真的不想从存储库中测试运行我的代码。 (我有一个 ../computations 目录outside 用于此)。理想情况下,计算目录将是来自 repo 的单向符号链接,以便对源(在 repo 内)的每次编辑都将立即可用于 ../computations 目录。

问题是没有单向符号链接这样的东西。一个 rsync shell 脚本与我可以接近存储库的单向镜像一样近,但我试图最大限度地减少我忘记(或厌倦)“更新”../computations 目录的机会。

我有什么选择?

更多详细信息:我正在使用跨越多个(但少于十个)目录的 C++ 和 Python 代码,并在 vim 中进行编辑。

【问题讨论】:

  • 告诉我们更多。什么操作系统?什么开发环境?你是如何构建你的代码的?您使用什么语言?

标签: symlink


【解决方案1】:

好的,接下来:

我们在/usr/local/bin 中有一个名为snk 的rsync 脚本,看起来像:

#! /bin/bash
# this script will rsync -a the ../repo directory
# with the ../computations directory on various architectures.  
# leave this script here (in the repo!) and create a symlink to it from someplace in your $PATH

# get this host
HOST=${HOSTNAME}

# define various hosts in order to dictate specific rsync commands
hostA="someHost"
hostB="someOtherHost"


if [ "$HOST" = "$hostA" ] 
then
    rsync -zvai --exclude=.svn /full/path/to/repo/on/hostA/ /full/path/to/computations

elif [ "$HOST" = "$hostB" ] 
then
rsync -zvai --exclude=.svn /full/path/to/repo/on/hostB/ /full/path/to/computations
fi

然后我们去了谷歌,发现:this qeustion about 'vim: rsync on save' 并试了一下。看看我的新.vimrc 文件的这一部分:

:if system('pwd') =~ "/full/path/to/base/of/repo"
:  au BufWritePost * !snk
:endif   

这是解决我的问题的一阶近似值,希望对您有所帮助!

谢谢vipraptor

【讨论】:

    猜你喜欢
    • 2018-06-20
    • 2023-03-14
    • 1970-01-01
    • 2017-01-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2014-12-10
    相关资源
    最近更新 更多