Merge lp:~jameinel/bzr/2.1.0b4-update-by-delta-bug into lp:bzr

Proposed by John A Meinel
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jameinel/bzr/2.1.0b4-update-by-delta-bug
Merge into: lp:bzr
Diff against target: 22 lines (+4/-4)
1 file modified
bzrlib/dirstate.py (+4/-4)
To merge this branch: bzr merge lp:~jameinel/bzr/2.1.0b4-update-by-delta-bug
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+14628@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This is actually the first in my series of win32 fixes that actually fixes a bug, rather than just cleaning up the test suite.

There was a place in "Dirstate.update_by_delta()" that was using "os.path.join()" rather than osutils.pathjoin(), and was thus putting 'foo\bar' style paths into the dirstate file.

Revision history for this message
Martin Pool (mbp) wrote :

> Which meant that on Windows the rename of 'a/b' => 'c/d' would show as a rename of 'a/b' => 'c/d'

I don't understand the problem.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
>> Which meant that on Windows the rename of 'a/b' => 'c/d' would show as a rename of 'a/b' => 'c/d'
>
> I don't understand the problem.

I probably wrote it a bit wrong.

A rename record in the dirstate ends up with 2 records. The location it
*was* at, and the location it is now at. A proper pair of records would
look like:

a b file-id r c/d OLD
c d file-id r NEW a/b

With this bug, we were getting:
                 v- wrong direction
a b file-id r c\d OLD
c d file-id r NEW a/b

Paths in dirstate are defined to be '/' separated, so using '\' is just
wrong.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr8DT4ACgkQJdeBCYSNAAMDIACeLpegL6wrSaN7fGRexs8W/IU1
dVwAn1wrGCvoizX8GXH7edp8+zMUD8yt
=MVxG
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/dirstate.py'
2--- bzrlib/dirstate.py 2009-10-02 05:43:41 +0000
3+++ bzrlib/dirstate.py 2009-11-08 22:20:24 +0000
4@@ -1339,14 +1339,14 @@
5 minikind = child[1][0][0]
6 fingerprint = child[1][0][4]
7 executable = child[1][0][3]
8- old_child_path = osutils.pathjoin(child[0][0],
9- child[0][1])
10+ old_child_path = osutils.pathjoin(child_dirname,
11+ child_basename)
12 removals[child[0][2]] = old_child_path
13 child_suffix = child_dirname[len(old_path):]
14 new_child_dirname = (new_path + child_suffix)
15 key = (new_child_dirname, child_basename, child[0][2])
16- new_child_path = os.path.join(new_child_dirname,
17- child_basename)
18+ new_child_path = osutils.pathjoin(new_child_dirname,
19+ child_basename)
20 insertions[child[0][2]] = (key, minikind, executable,
21 fingerprint, new_child_path)
22 self._check_delta_ids_absent(new_ids, delta, 0)