简体   繁体   中英

Mercurial: hg update on pre-existing files

I have uploaded files to a server (CentOS) via FTP. On the laptop, I've been using Mercurial for ages. I'd like to have Mercurial on the server as well, so I can push changes the right way.

I would like to know if the following steps are correct and would not lead to data loss:

  1. hg init on server (cannot get server to laptop to work, so no hg clone )
  2. hg push all revisions to server
  3. hg update the server to the latest revision
  4. Clean up server (commit unversioned files or delete them) and hg pull changes to laptop.

I have done steps 1 and 2, but am afraid hg update on the server will mess up files which are already there (they should be identical to the laptop, but I can't take chances).

Will hg update modify existing files?
Will hg update accept existing files that are identical to the repository, or will it create conflicts for them?
Will hg update mark inconsistencies as conflicts/added/missing?

I am aware that hg update -C does the opposite of what I want. Does that mean it is safe to use without -C ?

Many thanks in advance!

If I'm understanding what you're after, you can do it this way:

  1. Back up the directory on the server!
  2. hg update
  3. Copy the backed-up directory over the repo
  4. Do a diff, clean up folder, and commit the changes.

I believe that hg up will do what you're asking (keeping your changes, showing merge conflicts, etc.) but why not back it all up first and find out!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM