2012-07-24 2 views
2

때로는 병합 충돌을 추적 할 수없는 것처럼 보일 수 있습니다. 내 커밋되지 않은 파일 중 하나를 버리고 원격 복사본으로 업데이트 할 수있는 명령이 필요합니다.mercurial을 말하는 법 1. 로컬 파일을 버리십시오. 2. 리모트 파일을 사용하십시오.

나는 hg pull, hg pull, hg commit 에 의해 hg 되돌리기를 시도했지만 여전히 merge 나 commit을 허용하지 않을 것이다.

해결되지 않은 충돌을 먼저 해결하도록 알려줍니다.

답변

3

hg resolve을 사용하여 Mercurial에 충돌을 해결했음을 알릴 필요가있을 수 있습니다. 매뉴얼 페이지에서 :

hg resolve [OPTION]... [FILE]... 

redo merges or set/view the merge status of files 

    Merges with unresolved conflicts are often the result of non-interactive 
    merging using the "internal:merge" configuration setting, or a command- 
    line merge tool like "diff3". The resolve command is used to manage the 
    files involved in a merge, after "hg merge" has been run, and before "hg 
    commit" is run (i.e. the working directory must have two parents). See "hg 
    help merge-tools" for information on configuring merge tools. 

    The resolve command can be used in the following ways: 

    - "hg resolve [--tool TOOL] FILE...": attempt to re-merge the specified 
    files, discarding any previous merge attempts. Re-merging is not 
    performed for files already marked as resolved. Use "--all/-a" to select 
    all unresolved files. "--tool" can be used to specify the merge tool 
    used for the given files. It overrides the HGMERGE environment variable 
    and your configuration files. Previous file contents are saved with a 
    ".orig" suffix. 
    - "hg resolve -m [FILE]": mark a file as having been resolved (e.g. after 
    having manually fixed-up the files). The default is to mark all 
    unresolved files. 
    - "hg resolve -u [FILE]...": mark a file as unresolved. The default is to 
    mark all resolved files. 
    - "hg resolve -l": list files which had or still have conflicts. In the 
    printed list, "U" = unresolved and "R" = resolved. 

    Note that Mercurial will not let you commit files with unresolved merge 
    conflicts. You must use "hg resolve -m ..." before you can commit after a 
    conflicting merge. 

다음은 서버에서 파일 버전을 가져 오는 방법입니다. "hg pull"하면 서버의 모든 변경 사항이 저장소 복사본에 저장됩니다.

hg cat -r <rev> <file> 

로컬 파일을 덮어 쓰려면이를 사용하고 커밋하십시오.

+0

예 도구를 사용하여 해결할 수 있습니다 (서버에서 가져온 파일을 선택하면됩니다). 이 도구를 사용하지 않고 동일한 것을 달성 할 수있는 방법이 있습니까? –

+0

"hg resolve"는 도구를 사용할 필요가 없습니다. "-m"을 사용하여 파일을 해결 된 것으로 표시 할 수 있습니다. 아니면 내가 당신의 질문을 오해 했습니까? –

+0

마킹하기 전에 올바른 파일 (서버에있는 파일)이 있어야합니다. 로컬 복사본을 원격 복사본으로 업데이트해야합니다. 나는 병합하고 싶지 않아. 내 로컬 파일을 삭제해야합니다. –