2013-02-16 6 views
8

디렉토리 또는 파일에 대한 Mercurial에서 NIX 소프트 또는 하드 링크에 해당하는 항목이 있습니까? 파일 (또는 디렉토리) "다른 곳"파일에 연결되어소프트 링크 Mercurial

답변

7

의욕 버전 소프트 (한 병합해야 내가 생각하는 일반 지점과 달리) 그 위치의 버전을 다음되는 기본적 것을

저장소 내부에있는 링크만으로도 좋습니다. 그것은 그들을 탐지하고, 기록하고, 당신을 위해 그들을 만들 것입니다. 특정 유스 케이스를 찾고 있습니까? 저장소 외부에 도달하는 링크에 가장 가까운 것은 다른 repo의 특정 버전에 대한 포인터 인 subrepo입니다.

심볼릭 링크는

(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 [email protected] -> 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 <[email protected]> 
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 [email protected] -> target 
-rw-r--r-- 1 ry4an staff  5B Feb 16 19:26 target 

작동하지만, 하드 링크는 유닉스 계열의 시스템, hg Mercurial 감사 심볼릭 링크 ("심볼릭 링크")를 참조 경로 보안을위한에하지

$hg commit -Am "hardlinks target" 
adding link 
adding target 
$hg log -p 
changeset: 0:ec9407634133 
tag:   tip 
user:  Chris Wesseling <[email protected]> 
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 
+0

을 당신은 그것을 것 의미 버전 관리중인 파일에서 NIX 소프트 링크를 처리합니까? – Olav

+0

정확히. 위의 업데이트를 참조하십시오. –

+0

@ chris-wesseling 업데이트에 감사드립니다 그들은 soft/sym 링크에 대해 물어 보았지만 ht hardlink 정보를 가지고있는 것도 좋습니다. –

6

을한다. 예를 들어, 절대 경로와 빈 경로는 안전하지 않은 것으로 간주되어이므로 저장소에 추가되지 않습니다.

Mercurial 개발자는이 기능을 문서화하지 않았습니다. 그러나, 다소 모호한 설명과 함께 the source code contains a comment : Windows에서

class pathauditor(object): 
    '''ensure that a filesystem path contains no banned components. 
    the following properties of a path are checked: 

    - ends with a directory separator 
    - under top-level .hg 
    - starts at the root of a windows drive 
    - contains ".." 
    - traverses a symlink (e.g. a/symlink_here/b) 
    - inside a nested repository (a callback can be used to approve 
     some nested repositories, e.g., subrepositories) 
    ''' 

는 심볼릭 링크가 여러 가지 이유로 지원되지 않습니다, 참조 :

+0

절대 경로에 대한 심볼릭 링크를 수은 리포에 추가 할 수 있습니다. 나는이 문맥에서 "빈 길"이 무엇을 의미하는지 모른다. – Juan