OMG pull --overwrite overwrites not only files but all information about commits.... No. It doesn't

Bug #800771 reported by Kirill Danilov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

I made several commits in local repo and after that tried to push it to central SVN repo. I found that someone had changed project and branch became diverged. So for some reason I did pull with -overwrite option and lost not only any changes in files I did but all notices about commits and history.
I expect when I do commit it is saved forever. Nothing can erase information about that commit and file history of it except manual removing .bzr files and dirs from file system.
It is very strange that anyone can remove all records about done commits via standard bzr command.

Revision history for this message
Vincent Ladeuil (vila) wrote :

No. pull -overwrite does not delete the history of your branch.

It changes the tip (the tip revision defines the whole ancestry since each revisions is linked to its parent(s)).

The history associated with your previous tip is still present in the repository.

Look at 'bzr help heads' from the bzrtools plugin (especially the --dead-only parameter).

When you'll find your previous tip, you'll be able to restore it with 'bzr pull --overwrite -r<my_old_tip>' which will restore both your files and your tip (how ironic no ;).

When branches diverges, you need to merge them, so next time you want to 'bzr merge' before 'bzr push' but not 'bzr pull --overwrite'.

Changed in bzr:
status: New → Invalid
summary: - pull -overwrite overwrites not only files but all information about
- commits
+ OMG pull --overwrite overwrites not only files but all information about
+ commits.... No. It doesn't
Revision history for this message
Vincent Ladeuil (vila) wrote :

This occurs regularly and is scary for users who don't understand what is happening.

Displaying the tip (revno and revid) before doing the actual pull would probably make it easier to understand.

Changed in bzr:
importance: Undecided → Medium
status: Invalid → Confirmed
tags: added: confusing-ui easy
Revision history for this message
Kirill Danilov (donz4all) wrote :

Ok. Thank you.
It is really obscure.
And one more question. If I have only local commits I should do "bzr update -r <rev_no>", right? It works when I point dead branch but with internal error:

bzr: ERROR: bzrlib.errors.NoSuchRevision: BzrBranch7(file:///C:/Donz/Projects/MyPorject/) has no revision <email address hidden>

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 930, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1130, in run_bzr
  File "bzrlib\commands.pyo", line 691, in run_argv_aliases
  File "bzrlib\commands.pyo", line 713, in run
  File "bzrlib\cleanup.pyo", line 135, in run_simple
  File "bzrlib\cleanup.pyo", line 165, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 1513, in run
  File "bzrlib\decorators.pyo", line 154, in read_locked
  File "bzrlib\branch.pyo", line 385, in revision_id_to_dotted_revno
  File "bzrlib\branch.pyo", line 405, in _do_revision_id_to_dotted_revno
NoSuchRevision: BzrBranch7(file:///C:/Donz/Projects/MyProject/) has no revision <email address hidden>

bzr 2.4b4 on python 2.6.6 (Windows-7-6.1.7601-SP1)
arguments: ['C:\\Programs\\Bazaar2.4\\bzr.EXE', 'update', '-r',
    '<email address hidden>']
plugins: bzrtools[2.4.0], colo[0.3.0dev], explorer[1.1.3],
    fastimport[0.11.0dev], launchpad[2.4b4], loom[2.2.1dev],
    netrc_credential_store[2.4b4], news_merge[2.4b4], pipeline[1.1.0],
    qbzr[0.21b1], rewrite[0.7.0dev], svn[1.1.0dev], upload[1.0.1dev],
    xmloutput[0.8.7]
encoding: 'cp1251', fsenc: 'mbcs', lang: None

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Revision history for this message
Vincent Ladeuil (vila) wrote :

> And one more question. If I have only local commits I should do "bzr update -r <rev_no>", right?

I don't think you want to use -r<revno> here, just do 'bzr update' and see bzr help update:

Purpose: Update a tree to have the latest code committed to its branch.
Usage: bzr update [DIR]

Options:
  -v, --verbose Display more information.
  -h, --help Show help message.
  -q, --quiet Only display errors and warnings.
  --usage Show usage message and options.
  --show-base Show base revision text in conflicts.
  -r ARG, --revision=ARG
                        See "help revisionspec" for details.

Description:
  This will perform a merge into the working tree, and may generate
  conflicts. If you have any local changes, you will still
  need to commit them after the update for the update to be complete.

  If you want to discard your local changes, you can just do a
  'bzr revert' instead of 'bzr commit' after the update.

  If you want to restore a file that has been removed locally, use
  'bzr revert' instead of 'bzr update'.

  If the tree's branch is bound to a master branch, it will also update
  the branch from the master.

Aliases: up
See also: pull, status-flags, working-trees

Revision history for this message
Kirill Danilov (donz4all) wrote :

No, I meant if I already did "pull --overwrite" how can restore my overwritten local commits. Actually I found out this moment and just wanted to send you internal error that I got during this command.

Revision history for this message
Vincent Ladeuil (vila) wrote :

As said in my first response, you restore your branch history (your local commits are *not* overwritten, they are still in the repository but they are *not* part of the current branch history) by doing 'bzr pull --overwrite -r<revno_of_your_previous_tip>'.

Revision history for this message
Kirill Danilov (donz4all) wrote :

Yes, I understood that all my changes still available.
I wanted to report about internal error during update.
And you're not right. I can't make pull with -r option, because my "disappeared" commits were only in my local repo, but not on remote repo (I get "Requested revision doesn't exist in branch"). And I got these commit from local repo via update command but with pointed internal error.

Revision history for this message
Wouter van Heyst (larstiq) wrote : Re: [Bug 800771] Re: OMG pull --overwrite overwrites not only files but all information about commits.... No. It doesn't

On Thu, Jun 23, 2011 at 15:00:00 -0000, Kirill Danilov wrote:
> Yes, I understood that all my changes still available.
> I wanted to report about internal error during update.
> And you're not right. I can't make pull with -r option, because my "disappeared" commits were only in my local repo, but not on remote repo

The important detail here is to pull from your local repo, which is
usually specified as '.' for current dir:

    bzr pull . --overwrite -r <previous-revid>

Wouter

Revision history for this message
Kirill Danilov (donz4all) wrote :

Thanks. I feel something like this for local repo :)
But update really works, although it breaks with error.

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.