开发者

Moving hg repo folder using copy-paste?

I have a hg repo on my local drive. I am new to hg and want to know if i can move the folder around freely. I am not talking about a folder under version control, i am talking about the folder that contains the repo it self.

I've found a lot of similar questions but most seem to be talking about a folder under version control. another answer is to use hg clone but i want to k开发者_运维问答now if i can just cut and paste the whole repo.

I am using windows xp if that matters.


Yes, you can copy the repository itself by just copying the .hg folder.

Imagine the following folder structure:

MyRepo
MyRepo\.hg
MyRepo\file_under_version_control.txt

MyRepo is the whole repository (or as you called it, "folder under version control").

When you remove the .hg folder from it, MyRepo is just a normal folder without version control.

When you move the .hg folder somewhere else, you can create a new working directory by running hg update, so the new folder where .hg resides will be a complete repository again.


Technically you can, but you have two possibly unwanted outcomes if you do move your .hg folder:

  1. There source folder no longer has hg repository in it. It just becomes a plain directory with files.
  2. The destination folder suddenly has a (most likely) totally unrelated hg repository which you cannot really do anything meaningful with.

While the first outcome is no problem, the second likely is - unless the destination folder is just different working copy checked out from the same revision of your hg repository.


Yes, that is the whole idea behind DVSC (distributed version control systems), git also works in that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜