用 Mercurial 包装 Dropbox 进行版本控制 - 疯狂的想法?

发布于 2024-12-11 06:23:30 字数 1192 浏览 0 评论 0原文

我目前使用 Dropbox 作为我的源代码和资源的“备份”解决方案 - 它很好而且很漂亮,并且多次拯救了我的生活。

我发现自己现在需要一个合适的版本控制系统 - 而且我真的不想将存储库放在我的 Dropbox 文件夹中。

一方面,它很快就能填满我的 Dropbox 津贴;另一方面,我真的不希望 Dropbox 和版本控制软件为文件“争斗”。

所以我正在考虑做这样的事情(我正在使用 Mercurial,但我确信同样的理论也适用于其他 VC 的东西)

MYDOCS Folder <-- this is where the repo will go
    .hg (for Mercurial in this case)
    DROPBOX Folder
        WORK FOLDER
            PROJECT1
            PROJECT2
            PROJECT3
            ...

这样,我所做的一切都由 Dropbox 覆盖 - 但我的版本控制在 Dropbox 之外。

显然,并不是 DROPBOX 文件夹中的每个文件都是版本控制的 - 而且我的所有工作都只有 1 个存储库(不理想),但是任何人都可以看到这种方法的任何其他障碍吗?

注意:MYDOCS 是单独备份的(频率要低得多),因此不存在文件丢失的风险。

ps

我周末花了一些时间来实现这个(使用 Mercurial/TortoiseHG),它似乎工作得很好。

有一些障碍 - 你必须设置积极的忽略过滤器(最后我只是使用了“*”并手动添加了代码),否则 TortoiseHG 每次查找更改/新文件时都会盯着 10 个或 1000 个文件进行心脏病发作添加。

这意味着它也不会在现有项目中发现新文件,这是一个小麻烦 - 如果 Mercurial 在像这样的时候实际上有一个 INCLUDE 过滤器,那就太好了......

pps 我有一个好主意让这变得更容易一点。

我在 Dropbox 外部创建了一个名为“Repo”的新文件夹,并在其中创建了一个指向 Dropbox 内目录的目录连接(*nix 类型的链接),其中包含我的所有源代码(基本上是我的 Eclipse Workspace 目录)。

然后,我将我的存储库放入“repo”文件夹中 - 这样它就不会监督我的整个 Dropbox,而只是监督我想要的部分 - 而且它仍然不在我的 Dropbox “内部”;)

I currently use Dropbox as my "backup" solution for source and resources - and it's fine and dandy and has saved my bacon many times.

I find myself in need of a proper version control system now tho - and I really don't want to put a repository INSIDE my Dropbox folder.

For one thing, it will fill my Dropbox allowance pretty quickly - for another, I don't really want Dropbox and the version-control software 'fighting' over files.

So I'm thinking of doing something like this (I'm using Mercurial but I'm sure the same theory applies to other VC stuff)

MYDOCS Folder <-- this is where the repo will go
    .hg (for Mercurial in this case)
    DROPBOX Folder
        WORK FOLDER
            PROJECT1
            PROJECT2
            PROJECT3
            ...

That way, everything I work on is covered by Dropbox - but my version control is outside of Dropbox.

Obviously not every file in my DROPBOX folder is version controlled - and I'm stuck with only 1 Repository for ALL my work (not ideal) but can anyone see any other snags with this approach?

Note: MYDOCS is backed-up separately (much less often) so there's no risk of file loss here.

p.s.

I spent a bit of time over the weekend implementing this (using Mercurial/TortoiseHG) and it seems to work quite well.

There are some snags - you have to set aggressive ignore filters (in the end I just used "*" and added code manually) otherwise TortoiseHG has a heart-attack staring at 10s of 1000s of files every time it looks for changes/new files to add.

This means it won't spot new files in existing projects too which is a minor pain-in-the-neck - it would be great if Mercurial actually had an INCLUDE filter at times like this...

p.p.s. I had a bright idea to make this a BIT easier.

I created a new folder outside the Dropbox called "Repo" and inside that I created a Directory Junction (link for you *nix types) to the directory inside my Dropbox which contains all my source (my Eclipse Workspace directory - basically).

I then put my repo into the 'repo' folder - that way it's not overseeing my entire Dropbox, just the part of it I want it to - and it's still not 'inside' my Dropbox ;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

茶底世界 2024-12-18 06:23:30

正如您所指出的,这种方法的主要缺点是您被绑定到单个存储库。像 Mercurial 这样的分布式版本控制系统的一大优点是,对于独立的小项目来说,创建和使用存储库的成本很低。

为什么不直接使用 bitbucket.org 来满足您的版本控制需求?您可以根据需要创建任意数量的私有存储库并使用任意数量的磁盘。这里唯一的缺点是您可以与多少用户共享它们,但考虑到您上面概述的方法,这似乎不是问题。

As you point out, the major drawback of this approach is that you're tied to a single repository. One of the big advantages of distributed version control systems like Mercurial is that repositories are cheap to create and use for isolated little projects.

Why not just use bitbucket.org for your version control needs? You can create as many private repositories as you want and use as much disk as you want. The only drawback here is that you're limited to how many users you can share them with, but given the approach you outlined above, that doesn't seem to be a problem.

一个人的旅程 2024-12-18 06:23:30

将 .hg 目录保存在 Dropbox 中时,您不会遇到存储库损坏的情况,但您最终可能会减少提交,这也是一件令人遗憾的事情。

You won't suffer the repository corruption one sees when keeping the .hg directory in Dropbox, but you'll probably end up committing less which is a bummer too.

浮华 2024-12-18 06:23:30

Mercurial 将根目录硬编码为与工作目录处于同一级别,因此我认为您无法更改此设置。

然而,您可以做的是将 .hg 目录符号链接到另一个目录:

cd WORK_FOLDER
ln -s ../MYDOCS_Folder/.hg .hg
hg up null   # to reset the dirstate
hg up

Mercurial 将遵循符号链接并正常运行,但 Dropbox(如果运行正常)可能不会。当您执行此操作时,请确保永远不要在 WORK FOLDER 中执行任何操作,因为这会使事情变得混乱。

老实说,我不推荐这种工作流程,因为它看起来很脆弱。

Mercurial hard-codes the root to be on the same level as the working directory, so I don’t think you can change this.

What you could do however is to symlink the .hg directory to another directory:

cd WORK_FOLDER
ln -s ../MYDOCS_Folder/.hg .hg
hg up null   # to reset the dirstate
hg up

Mercurial will follow the symbolic link and operate as normal, but probably Dropbox (if it’s behaving sanely) won’t. When you do this, make sure to never do any operations in WORK FOLDER because that will mess things up.

To be honest I wouldn’t recommend this kind of workflow though, it seems fragile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文