Mercurial:推动文件从外部来源改变

时间:2011-12-07 18:21:05

标签: mercurial

知道这是一个令人费解的场景,但这是我的情况。我们有 正在更新文件(* .doc)并将其发布到SharePoint。我想要他们在Mercurial。我们有一个脚本可以将这些文件导出到一个标记为mercurial存储库(克隆)的Windows共享,目的是自动将文件推送到一个中央的mercurial存储库。

文件的初始导出导致这些文件被标记为无版本。一个简单的

hg add 
hg push 

将文件移动到所需的中央仓库。这些文件每晚自动导出(覆盖文件)到Windows共享。但mercurial不承认任何变化。

hg status 

结果是空的。

我的问题是如何让Mercurial认识到这些变化以便推动它们?

由于

1 个答案:

答案 0 :(得分:0)

我的理解是你有两个回购,一个是中央回购的克隆。您必须从这里将它们视为单独的存储库。 hg status仅显示repo中working copy和pristine文件之间的差异(.hg directory) 对回购的更改将显示在hg log而非hg status

这是一个正常的程序。

              +------+            +------+
              |Repo A|            |Repo B|
              +------+            +------+
 New File        |                   |
 .............>  |                   |
                 | hg add            |
                 | hg commit         |
 Files in repo A |                   |
 --------------- |                   |
                 |      hg push      |
                 |------------------ |  Files in Repo B
                 |      hg pull      |
                 |                   |  hg update
                 |                   |  hg status (empty)
                 |                   |  hg log (Will show new
                                                  version )

MS word Doc文件也会被视为二进制文件,您可能无法充分利用版本控制。

抱歉有点迂腐,但repo和工作目录之间的区别导致了足够的混乱。回购邮件中的文件只会显示hg update

      +------------+                 +---------+
      |Your working|                 |Your Repo|
      |directory   |                 |.hg dir  |
      +------------+                 +---------+
            |                             |
            |        hg status            |
            |-----------------------------|
            |   shows difference between  |  hg pull <--
            |      working dir and repo   |-------------
            |                             |  <-- hg push
            |                             |     from another repo
            |                             |
            |         hg update           |  hg pull or push
            | <-------------------------- |  deals with repo
            |   This brings latest change |  and not working
            |   version from repo to      |  dir
                   working dir