[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "No safeguard against rewriting upstream bzr history"
From: |
Wolfgang Jenkner |
Subject: |
Re: "No safeguard against rewriting upstream bzr history" |
Date: |
Sun, 05 Jan 2014 19:38:18 +0100 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (berkeley-unix) |
On Sun, Jan 05 2014, Joshua Judson Rosen wrote:
> Thien-Thi Nguyen <address@hidden> writes:
>>
>> - Investigate "no safeguard against rewriting upstream bzr repo history":
>> <http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00098.html>.
>>
>> I'd like to determine if the "doesn't work" part lies in bzrlib or
>> in git-remote-bzr. I suspect the latter, since there is no call
>> to ‘die’ in that code. Hmmm, time to snapshot the (relatively)
>> svelte repo and see what damage a tweaked git-remote-bzr can do,
>> i suppose...
>
> If it's true, one could also say that the upstream branches
> are misconfigured: if you set "append_revisions_only = True"
> in the branch's .bzr/branch/branch.conf, then the bzr
> server will enforce that revisions are only ever added to
> the left hand side (mainline edge) of the DAG and never
> removed (either by uncommitting or by re-orienting the DAG).
[...]
> When creating new branches, there's an argument to "bzr init"
> that sets this option;
Thank you very much for this explanation! Indeed, with this switch, the
local experiment in
http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00094.html
gives the following:
[1 /tmp]$ bzr init --append-revisions-only trunk
Created a standalone tree (format: 2a)
[2 /tmp]$ cat trunk/.bzr/branch/branch.conf
append_revisions_only = True
[3 /tmp]$ (cd trunk && touch foo && bzr add $_ && bzr commit -m X && bzr log
--line)
adding foo
Committing to: /tmp/trunk/
added foo
Committed revision 1.
1: Wolfgang Jenkner 2014-01-05 X
[4 /tmp]$ git clone bzr::trunk local
Cloning into 'local'...
Checking connectivity... done.
[5 /tmp]$ (cd trunk && echo "trunk change" >foo && bzr commit -m A && bzr log
--line)
Committing to: /tmp/trunk/
modified foo
Committed revision 2.
2: Wolfgang Jenkner 2014-01-05 A
1: Wolfgang Jenkner 2014-01-05 X
[6 /tmp]$ (cd local && echo "local change" >foo && git commit -a -m B && git
log --oneline && git push)
[master d494366] B
1 file changed, 1 insertion(+)
d494366 B
2fa9952 X
Traceback (most recent call last):
File "/home/wolfgang/bin/git-remote-bzr", line 947, in <module>
sys.exit(main(sys.argv))
File "/home/wolfgang/bin/git-remote-bzr", line 933, in main
do_export(parser)
File "/home/wolfgang/bin/git-remote-bzr", line 682, in do_export
branch.generate_revision_history(revid, marks.get_tip(name))
File "<string>", line 4, in generate_revision_history_write_locked
File "/usr/local/lib/python2.7/site-packages/bzrlib/branch.py", line 816, in
generate_revision_history
self.set_last_revision_info(revno, revision_id)
File "<string>", line 4, in set_last_revision_info_write_locked
File "/usr/local/lib/python2.7/site-packages/bzrlib/branch.py", line 2524, in
set_last_revision_info
self._check_history_violation(revision_id)
File "/usr/local/lib/python2.7/site-packages/bzrlib/branch.py", line 2727, in
_check_history_violation
raise errors.AppendRevisionsOnlyViolation(self.user_url)
bzrlib.errors.AppendRevisionsOnlyViolation: Operation denied because it would
change the main history, which is not permitted by the append_revisions_only
setting on branch "/tmp/trunk/".
[7 /tmp]$ (cd trunk && bzr log --line)
2: Wolfgang Jenkner 2014-01-05 A
1: Wolfgang Jenkner 2014-01-05 X
[8 /tmp]$ (cd trunk && bzr status)
[9 /tmp]$ (cd trunk && bzr diff)
[10 /tmp]$
So part of the bzrlib safeguard against rewriting history is actually in
one of the callees of generate_revision_history, while git-remote-bzr
seems to assume that it is all in push_branch.
Wolfgang
Re: bzr is dying; Emacs needs to move, Samuel Bronson, 2014/01/03
Re: bzr is dying; Emacs needs to move, Bozhidar Batsov, 2014/01/02
Re: bzr is dying; Emacs needs to move, Richard Stallman, 2014/01/02