Mercurial中的软链接 [英] Soft link in Mercurial

查看:72
本文介绍了Mercurial中的软链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mercurial中是否有与目录或文件的NIX软链接或硬链接等效的内容.

Is there some equivalent in Mercurial to NIX soft- or hard- links to directories or files.

基本上,文件(或目录)链接到文件其他位置"并遵循该位置的版本(与我认为的常规分支不同,我认为常规分支必须合并)

Basically that a file (or directory) is linked to a file "somewhere else" and follows the version of that location (Unlike a regular branch I think, where one would have to merge)

推荐答案

存储库内部的Mercurial版本软链接非常好.它会检测它们,记录它们,并为您创建它们.您是否在寻找特定的用例?子库是最接近存储库外部的链接的子存储库,它是指向另一个存储库的特定版本的指针.

Mercurial versions soft links that are internal to the repository just great. It'll detect them, record them, and create them for you. Is there a specific use case you're looking for? The closest thing to an link that reaches outside the repository is a subrepo, which is a pointer to a specific version of another repo.

符号链接有效

(df)Ry4ans-MacBook-Air:~ ry4an$ hg init olav
(df)Ry4ans-MacBook-Air:~ ry4an$ cd olav/
(df)Ry4ans-MacBook-Air:olav ry4an$ echo this > target
(df)Ry4ans-MacBook-Air:olav ry4an$ ln -s target link
(df)Ry4ans-MacBook-Air:olav ry4an$ ls -l
total 16
lrwxr-xr-x  1 ry4an  staff     6B Feb 16 19:25 link@ -> target
-rw-r--r--  1 ry4an  staff     5B Feb 16 19:25 target
(df)Ry4ans-MacBook-Air:olav ry4an$ hg commit -A -m "link and its target"
adding link
adding target
(df)Ry4ans-MacBook-Air:olav ry4an$ hg log -p
changeset:   0:42a41a431661
tag:         tip
user:        Ry4an Brase <ry4an-hg@ry4an.org>
date:        Sat Feb 16 19:26:17 2013 -0500
summary:     link and its target

diff -r 000000000000 -r 42a41a431661 link
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/link  Sat Feb 16 19:26:17 2013 -0500
@@ -0,0 +1,1 @@
+target
\ No newline at end of file
diff -r 000000000000 -r 42a41a431661 target
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/target    Sat Feb 16 19:26:17 2013 -0500
@@ -0,0 +1,1 @@
+this

(df)Ry4ans-MacBook-Air:olav ry4an$ hg update null
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
(df)Ry4ans-MacBook-Air:olav ry4an$ ls -l
(df)Ry4ans-MacBook-Air:olav ry4an$ hg update tip
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(df)Ry4ans-MacBook-Air:olav ry4an$ ls -l
total 16
lrwxr-xr-x  1 ry4an  staff     6B Feb 16 19:26 link@ -> target
-rw-r--r--  1 ry4an  staff     5B Feb 16 19:26 target

但是硬链接没有

$hg commit -Am "hardlinks target"
adding link
adding target
$hg log -p
changeset:   0:ec9407634133
tag:         tip
user:        Chris Wesseling <chris.wesseling@cwi.nl>
date:        Wed Mar 13 23:14:44 2013 +0100
summary:     hardlinks target

diff -r 000000000000 -r ec9407634133 link
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/link      Wed Mar 13 23:14:44 2013 +0100
@@ -0,0 +1,1 @@
+foo
diff -r 000000000000 -r ec9407634133 target
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/target    Wed Mar 13 23:14:44 2013 +0100
@@ -0,0 +1,1 @@
+foo

$ls -lin
total 8
276702 -rw-r--r-- 2 1204653 5900 4 13 mrt 23:14 link
276702 -rw-r--r-- 2 1204653 5900 4 13 mrt 23:14 target
$hg update null
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
$hg update tip
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ls -lin
total 8
276719 -rw-r--r-- 1 1204653 5900 4 13 mrt 23:15 link
276721 -rw-r--r-- 1 1204653 5900 4 13 mrt 23:15 target

这篇关于Mercurial中的软链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆