Mercurial 删除了未跟踪的文件

发布于 2024-10-16 15:00:10 字数 333 浏览 2 评论 0原文

在我们的存储库中,我们有数据库的初始版本(二进制文件)。

我已经执行了 hg pull,我看到有人提交了该文件的另一个版本。 由于我不会丢失开发数据库中的更改,因此我在同一目录中制作了它的副本(复制 file.db my_file.db)。

当我运行 hg up 时,mercurial 用新版本覆盖了 file.db 并删除了 my_file.db!

我使用的是 Windows 7 x64,并尝试了各种恢复已删除文件的软件,但没有成功。

如何取回我的 file.db 版本或恢复 my_file.db?我没有犯。

In our repository we have initial version of database (binary file).

I have executed hg pull and I saw that someone committed another version of this file.
As I won't to loose my changes in dev db, I did make a copy of it (copy file.db my_file.db) in same directory.

When I runned hg up, mercurial overwrited file.db with new version and deleted my_file.db!

I'm on windows 7 x64, and tried various software that recover deleted files, but with no success.

How can I get back my version of file.db or recover my_file.db? I didn't commit it.

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

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

发布评论

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

评论(1

寄居人 2024-10-23 15:00:10

我真的不认为 Mercurial 删除了您未跟踪的文件。这是我所理解的您所描述的顺序:

ry4an@four:~$ mkdir zote
ry4an@four:~$ cd zote
ry4an@four:~/zote$ hg init orig
ry4an@four:~/zote$ echo text > orig/file.db
ry4an@four:~/zote$ hg -R orig commit -A -m 'initial'
adding file.db
ry4an@four:~/zote$ hg clone orig clone
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote$ mv clone/file.db clone/my_file.db
ry4an@four:~/zote$ echo more text >> orig/file.db
ry4an@four:~/zote$ hg -R orig commit -m 'new line'
ry4an@four:~/zote$ hg -R clone pull
pulling from /home/ry4an/zote/orig
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
ry4an@four:~/zote$ hg -R clone update
remote changed file.db which local deleted
use (c)hanged version or leave (d)eleted? c
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote$ ls clone/
file.db  my_file.db
ry4an@four:~/zote$ cat clone/my_file.db 
text
ry4an@four:~/zote$ hg -R clone status
? my_file.db

您可以看到之后 my_file.db 仍然存在。即使使用 --clean 正如 Mikezx6r 提到的,该文件仍然存在:

pulling from /home/ry4an/zote/orig
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
ry4an@four:~/zote/clone$ hg update --clean
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote/clone$ ls -l
total 8
-rw-r--r-- 1 ry4an ry4an 15 2011-02-08 14:31 file.db
-rw-r--r-- 1 ry4an ry4an  5 2011-02-08 14:28 my_file.db
ry4an@four:~/zote/clone$ hg stat
? my_file.db
ry4an@four:~/zote/clone$ 

这不是您想听到的,但更有可能您不小心弄乱了“mv”,并且只认为您创建了副本或以某种方式外部删除了它。或者您的防病毒应用程序看到了它不喜欢的模式而拒绝创建它,或者其他一些可怕的意外事件。

现在它也没有帮助,但这是一个很好的例子,说明了为什么您应该尽早且经常提交,尤其是在更新之前 - 它太容易犯错误,但是一旦某些内容进入存储库,您就无法执行任何操作来意外删除它。

I really don't think mercurial deleted your untracked file. Here's the sequence you've described as I understand it:

ry4an@four:~$ mkdir zote
ry4an@four:~$ cd zote
ry4an@four:~/zote$ hg init orig
ry4an@four:~/zote$ echo text > orig/file.db
ry4an@four:~/zote$ hg -R orig commit -A -m 'initial'
adding file.db
ry4an@four:~/zote$ hg clone orig clone
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote$ mv clone/file.db clone/my_file.db
ry4an@four:~/zote$ echo more text >> orig/file.db
ry4an@four:~/zote$ hg -R orig commit -m 'new line'
ry4an@four:~/zote$ hg -R clone pull
pulling from /home/ry4an/zote/orig
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
ry4an@four:~/zote$ hg -R clone update
remote changed file.db which local deleted
use (c)hanged version or leave (d)eleted? c
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote$ ls clone/
file.db  my_file.db
ry4an@four:~/zote$ cat clone/my_file.db 
text
ry4an@four:~/zote$ hg -R clone status
? my_file.db

You can see that afterward my_file.db is still there. Even with --clean as Mikezx6r mentiones the file is still there:

pulling from /home/ry4an/zote/orig
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
ry4an@four:~/zote/clone$ hg update --clean
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ry4an@four:~/zote/clone$ ls -l
total 8
-rw-r--r-- 1 ry4an ry4an 15 2011-02-08 14:31 file.db
-rw-r--r-- 1 ry4an ry4an  5 2011-02-08 14:28 my_file.db
ry4an@four:~/zote/clone$ hg stat
? my_file.db
ry4an@four:~/zote/clone$ 

It's not what you want to hear, but it's much more likely you accidentally botched the 'mv' and only thought you created the copy or somehow externally deleted it. Or your antivirus app saw a pattern it didn't like a refused to create it, or some other horrible, accidental thing.

It's also not helpful now, but this is a great example of why you should commit early and often, and especially before updating -- it's just too easy to make mistakes, but once something in in the repo there's nothing you can do to accidentally remove it.

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