Revert, then commit, then revert again
Simon King
simon at simonking.org.uk
Tue Jan 8 16:23:27 UTC 2013
On Tue, Jan 8, 2013 at 3:49 PM, Samuel Sumner <ssumneraum at gmail.com> wrote:
> On Mon, Jan 7, 2013 at 2:24 PM, Kevin Bullock
> <kbullock+mercurial at ringworld.org> wrote:
>>
>> On Jan 7, 2013, at 12:37 PM, Samuel Sumner wrote:
>>
>> > So I was working on a project in C++ that we had source controlled in
>> > Mercurial. I eventually had made so many mistakes on the last revision, that
>> > I wasn't getting anywhere
>>
>> And did you commit any of these changes?
>>
> Yes, I committed to my local repository (but did not push to the central
> repository, as changes were not stable).
>
>>
>> > so I reverted:
>> >
>> > hg update -r 23
>> >
>> > Then I made some successful changes, and committed normally.
>> >
>> > hg commit -u .....
>> >
>> > I still have a few minor mistakes, and in trying to solve them I realize
>> > I had written some code in the first tip (before the revert). Is there any
>> > way to see the files from that revision? Or have the changes been
>> > overwritten by the subsequent commit?
>>
>>
>> If you had committed before the update -r23, those changes are still in
>> the repository. You can:
>>
>> - see the heads of both lines of development with `hg heads`
>
>
> 'hg heads' shows only two heads: rev 24 (the most recent changes, resulting
> from a commit after the update -r 23) and rev. 23 itself.
>
This doesn't seem right - if you had really updated to r23 before
committing to create r24, r23 would not be a head. What does the
repository graph look like? ("hg log --graph" if you are using at
least mercurial 2.3)
>>
>> - see the graph of branches with `hg log --graph`
>> - update to the other head with `hg update REV`, where REV is the local
>> revision number or changeset ID you found with `hg heads`,
>> - merge the two branches together with `hg merge REV`
>>
>> Etc. See one or more of:
>>
>> http://mercurial.selenic.com/wiki/Tutorial
>> http://mercurial.selenic.com/wiki/QuickStart
>> http://hgbook.red-bean.com
>> http://hginit.com
>>
>> pacem in terris / мир / शान्ति / سَلاَم / 平和
>> Kevin R. Bullock
>>
>
> It appears that that particular revision is not there, or it is possible
> that I forgot to commit, although I could have sworn I did. If there is no
> other way to look up any revisions that are not showing, then I must have
> overwritten the changes without committing. Thanks for your help.
>
"hg log" will show all revisions in the repository. "hg log --graph"
is useful for seeing the relationship between the revisions.
Simon
More information about the Mercurial
mailing list