The short question is: if I hg rollback
, how does Peter get my rolled back version if he cloned from me? What are the exact steps he or me has to do or type?
This is related to In Mercurial, when Peter "hg clone" me, and I commit and he pull and update, he gets my version, but not when I rollback?
The details:
After the following steps, Mary has 7
and Peter has 11
. My repository is 7
What are the exact steps Peter or me has to do or type SO THAT PETER GETS 7 back?
F:\>hg init hgme
F:\>cd hgme
F:\hgme>echo the code is 7 > code.txt
F:\hgme>hg add code.txt
F:\hgme>hg commit -m "this is version 1"
F:\hgme>cd ..
F:\>hg clone hgme hgpeter
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
F:\>type hgpeter\code.txt
the code is 7
F:\>cd hgme
F:\hgme>notepad code.txt [now i change 7 to 11]
F:\hgme>hg commit -m "this is version 2"
F:\hgme>cd ..\hgpeter
F:\hgpeter>hg pull
pulling from f:\hgme
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)
F:\hgpeter>hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
F:\hgpeter>type code.txt
the code is 11
F:\hgpeter>cd ..\hgme
F:\hgme>hg rollback
rolling back last transaction
F:\hgme>cd ..
F:\>hg clone hgme hgmary
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
F:\>type hgmary\code.txt
the code is 7
F:\>cd hgpeter
F:\hgpeter>hg pull
pulling from f:\hgme
searching for changes
no changes found
F:\hgpeter>type code.txt
the code is 11
What are the exact steps Peter or me has to do or type SO THAT PETER GETS 7 back? There should be some steps that Peter can do to get the "current state" of my repository since he cloned from me. I shouldn't need to knock on his front door to tell him, "hey, you need to rollback" or whatever.
If someone has already pulled your changes (which is the case you're describing), a rollback isn't appropriate.
From hg
manual:
This command is not intended for use on public repositories. Once changes are visible for pull by other users, rolling a transaction back locally is ineffective (someone else may already have pulled the changes). Furthermore, a race is possible with readers of the repository; for example an in-progress pull from the repository may fail if a rollback is performed.
What you should do is hg backout
the changeset, then tell Peter to pull.
If you insist on rolling back, you could tell Peter to reclone the repository, but I wouldn't recommend working this way.