/srv/irclogs.ubuntu.com/2016/10/19/#bzr.txt

LeoNerdSo.. Nobody has any thoughts about my broken shelf problem? Am I going to have to manually unpick the pack file myself?14:49
mgzI think I had a way back, but has been a while and I'm not sure I remember it I'm afraid14:50
LeoNerdIt looks manually -possible-, just a little awkward. the changes that are shelved are one newly-added file (easy to pull out), and some inserts/deletes of lines in another file14:50
LeoNerdThe inserts look easy enough. the deletes look the hardest bit to unpick manually, because I'll have to count line numbers of the 'c' lines14:51
LeoNerdI think the entire pack is only upset about the newly created directory, so if I can somehow split the pack file into two packs, one that creates the new file in the new directory and one that does the edits to existing files, that might make it simpler14:51
LeoNerdThe new file is added in a new dir- and that's the one I can easily unpick by hand]14:52
fullermdMaybe you could try backing up to the rev where you'd shelved 'em, and unshelving there?14:53
LeoNerdThat's not the issue.14:53
LeoNerdI don't think14:53
LeoNerdI think the issue is that I shelved adding a file to a new directory, but I didn't shelve adding that directory14:53
fullermdSeems like I have vague memories of some dance like that working once upon a time.14:53
* LeoNerd will give it a go anyway14:55
LeoNerdNope.. still upset about:  bzr: ERROR: No final name for trans_id 'new-3'14:56
LeoNerdIs the pack format actually documented somewhere? I feel it ought to be justabout possible to manually split this file into two pieces.. one that adds a file and one that has all the other-file edits14:59
LeoNerdI suspect it's only the former that's upset, but that one is easy for me to manually unpick14:59
LeoNerdI'm just not -quite- sure I understand how to parse the metadata and attribs sections at the top of the file14:59
fullermdApart from the source (hopefully the comments in), I don't think so.15:00
LeoNerdhttp://paste.debian.net/883914/15:00
LeoNerdis the header15:00
LeoNerdI've sortof worked out those lines that begin d15:00
LeoNerdThey appear to be a decimal number then a comma then that number of bytes... a list of strings. apparently an even-sized kv assoc list15:00
fullermdYeah, it's some sort of KLV.15:01
LeoNerdThe attribs one is harder. It seems to be 'd', a 10-byte string ("_id_number"), then the next stream character is 'i' which I'm not sure what it means15:02
LeoNerdmaybe it's an "integer" value, ... which could be 30, ending at the 'e'?15:03
fullermdI think it's bencoding?15:05
LeoNerdhttps://en.wikipedia.org/wiki/Bencode ?15:05
fullermdYeah.15:06
LeoNerdAh.. that looks useful, thanks15:06
LeoNerdOK that looks quite simple. I wonder if I could write me up a quick bencode <-> JSON converter to make it easier to manually manipulate15:06
* LeoNerd , unrelatedly, still sad that pastie.org seems to have died :(15:07
fullermdWell, considering bzrlib has a bencode implementation, and I'm sure somebody has written a JSON implementation for python sometime...15:07
LeoNerdBy far the best pastebin I used15:07
fullermdActually, in a little poking, bzrlib's implementation (at least the .py version; it uses a .pyx mostly) looks like just an import/edit of the code from some bittorrent implementation anyway.15:09
LeoNerdMmm :)15:09
fullermde.g., compare bzrlib/util/_bencode_py.py with http://www.math.uiuc.edu/~gfrancis/illimath/windows/aszgard_mini/pylibs/bzrlib/util/bencode.py15:11
fullermdTake out some of the class wrapping and the like...15:11
LeoNerdEh; it looks quite easy and trivial enough to reïmplement15:12
* LeoNerd was going to use it as an excuse to add another example into Parser::MGC anyway15:12
fullermdPshaw.  Obviously you'd build it on Marpa...15:13
LeoNerdHellno15:13
fullermdBut then, there's apparently Convert::Bencode already too15:14
LeoNerdYah probably. Again, it's an excuse to write example code15:15
LeoNerdBecause people always complain I don't have enough15:15
fullermdThat leads to recursion, though.  You start writing some sample code, you shelve part of it, and then suddenly...15:15
LeoNerdThen suddenly I'm stuck under a car fixing bits of it in order to change a lightbulb ;)15:16
fullermdIn point of fact, I did exactly that a couple years ago    :p15:17
fullermdI had to go buy a switch to replace a stupid dimmer, and on the way back my brake caliper locked up.15:17
LeoNerdHrmmmmm...15:33
LeoNerdd7:message13:State objects11:revision_id54:leonerd@leonerd.org.uk-20161018213449-8qaa6cpx1l9ph0j9eB1063   <== is the metadata field15:33
LeoNerdIt's a dict of  message => "State objects", revision_id => (that long string)  which ends at the 'e' and then that  B1063  seems to be trailing15:33
LeoNerdAny idea what that is?15:34
LeoNerdIf I stop at that e then it's fine15:34
LeoNerdOoh... maybe I wasn't supposed to include that.. because before that, there was a  B98  marker15:36
* LeoNerd mumbles that pack format doesn't linefeed-terminate its blocks15:38
fullermdB looks like a marker in the pack header.  At least in a quick glance at the code, which I can't read.15:38
LeoNerdYeah.. the pack file itself seems to be a one-line header, followed by data blocks that are B then a decimal integer giving the byte count then a linefeed then that many bytes15:39
LeoNerdbut no linefeed after the data block payload, meaning that the next B marker for every subsequent block starts at the end of the previousl ine15:39
LeoNerdhttp://paste.debian.net/883932/  <== is my decoded attribs section anyway... this appears to be working :)15:41
LeoNerdSo.. I wonder if we can work out from here what the error message means15:42
fullermdOh, shucks, you can do that by deduction from the message itself   :p15:43
LeoNerdI might if I knew what a "final name" is15:44
fullermdOr rather, you can assume something plausible, and since there's nobody around to contradict it, you're right by default.15:44
LeoNerdOh.. that little "_new_name" chunk?15:44
LeoNerdAh.. maybe I just have to add  'new-3' => 'Room'  into that15:45
LeoNerdOh.. and _new_parent otherwise it doesn't know where to root it15:46
fullermdThe problem, as best I guess, is that new-%d is a standin file id shelf puts on things that don't already have one.15:46
fullermdSo since the dir wasn't committed yet when the file was shelved, it didn't have one, so got a standin.  Now there's nothing in the tree with that standin, so it has no idea where to put the file.15:46
LeoNerdHmmm15:47
fullermdSo, in _theory_, if you horked up the transform in the pack so it tried to put it under the actual file-id of the directory...15:47
LeoNerdBut it has a new id15:47
LeoNerd                         'new-3' => 'room-20161015171947-i9zc40ts93rt5svr-1',15:47
fullermdIs that the directory?15:48
LeoNerdlib/Net/Async/Matrix/Room                          room-20161015171947-i9zc40ts93rt5svr-115:48
LeoNerdAccording to   bzr inventory --show-ids15:48
LeoNerdand the dir exists15:48
fullermdSee?  If you'd just kept quiet, I would have been right.15:48
LeoNerdHah15:49
LeoNerdI think I may start by splitting the shelf in half anyway, see if I can make those two separate pieces to simplify things15:50
fullermdHaving all those smarts in shelves is really nice, until it isn't   :|15:57
LeoNerdOoooh15:59
LeoNerdSo having nuked all mention of new-2 or new-3 and fixed up the byte lengths, unshelve --preview is happy16:00
LeoNerdand bzr unshelve  itself did it :)16:00
LeoNerdWoo.. this seems fine16:00
LeoNerdNow all that's missing is the entire content of the new file but I can cut that verbatim from the shelf file16:00
LeoNerdaaaaaand we're back16:01
LeoNerdofcourse my extracted code doesn't even compile let alone pass its tests, but that's my fault now. ;)16:02
fullermdMan, that whole procedure sounds like something you'd find in chapter 7 of "Git For People Smarter Than You".16:02
LeoNerdAnyhow thanks much for that bencode hint - that seemed to be the key to the whole process16:03
LeoNerdfullermd++16:03
fullermdYay, I did something good.  I can go accomplish nothing the rest of the day then.16:04
LeoNerd:)16:04
LeoNerdmeh.. now I'm too nervous to use the shelf with a pending mkdir hanging around21:14
LeoNerdHrm... also I find myself wanting an  unshelve  with yes/no questions per chunk21:38

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!