comparison src/org/tmatesoft/hg/repo/HgDirstate.java @ 227:0fd10e5016dd

IOException on empty repository with 40-byte dirstate
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 25 May 2011 13:13:36 +0200
parents 8248aae33f7d
children 1792b37650f2
comparison
equal deleted inserted replaced
226:26ad7827a62d 227:0fd10e5016dd
73 try { 73 try {
74 // XXX skip(40) if we don't need these? 74 // XXX skip(40) if we don't need these?
75 byte[] parents = new byte[40]; 75 byte[] parents = new byte[40];
76 da.readBytes(parents, 0, 40); 76 da.readBytes(parents, 0, 40);
77 parents = null; 77 parents = null;
78 do { 78 // hg init; hg up produces an empty repository where dirstate has parents (40 bytes) only
79 while (!da.isEmpty()) {
79 final byte state = da.readByte(); 80 final byte state = da.readByte();
80 final int fmode = da.readInt(); 81 final int fmode = da.readInt();
81 final int size = da.readInt(); 82 final int size = da.readInt();
82 final int time = da.readInt(); 83 final int time = da.readInt();
83 final int nameLen = da.readInt(); 84 final int nameLen = da.readInt();
104 } else if (state == 'm') { 105 } else if (state == 'm') {
105 merged.put(r.name1, r); 106 merged.put(r.name1, r);
106 } else { 107 } else {
107 // FIXME log error? 108 // FIXME log error?
108 } 109 }
109 } while (!da.isEmpty()); 110 }
110 } catch (IOException ex) { 111 } catch (IOException ex) {
111 ex.printStackTrace(); // FIXME log error, clean dirstate? 112 ex.printStackTrace(); // FIXME log error, clean dirstate?
112 } finally { 113 } finally {
113 da.done(); 114 da.done();
114 } 115 }