##// END OF EJS Templates
fix some rename/copy bugs...
mpm@selenic.com -
r1117:30ab5b8e default
parent child Browse files
Show More
@@ -0,0 +1,41
1 #!/bin/sh
2
3 hg init
4 echo foo > foo
5 hg add foo
6 hg commit -m1 -d"0 0"
7
8 echo "# should show copy"
9 cp foo bar
10 hg copy foo bar
11 hg debugstate
12
13 echo "# shouldn't show copy"
14 hg commit -m2 -d"0 0"
15 hg debugstate
16
17 echo "# should match"
18 hg debugindex .hg/data/foo.i
19 hg debugrename bar
20
21 echo bleah > foo
22 echo quux > bar
23 hg commit -m3 -d"0 0"
24
25 echo "# should not be renamed"
26 hg debugrename bar
27
28 cp foo bar
29 hg copy foo bar
30 echo "# should show copy"
31 hg debugstate
32 hg commit -m3 -d"0 0"
33
34 echo "# should show no parents for tip"
35 hg debugindex .hg/data/bar.i
36 echo "# should match"
37 hg debugindex .hg/data/foo.i
38 hg debugrename bar
39
40 echo "# should show no copies"
41 hg debugstate No newline at end of file
@@ -0,0 +1,34
1 # should show copy
2 a 644 4 08/28/05 05:00:19 bar
3 n 644 4 08/28/05 05:00:19 foo
4
5 foo -> bar
6 # shouldn't show copy
7 n 644 4 08/28/05 05:00:19 bar
8 n 644 4 08/28/05 05:00:19 foo
9
10 # should match
11 rev offset length base linkrev nodeid p1 p2
12 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
13 renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
14 # should not be renamed
15 not renamed
16 # should show copy
17 n 644 5 08/28/05 05:00:19 bar
18 n 644 6 08/28/05 05:00:19 foo
19
20 foo -> bar
21 # should show no parents for tip
22 rev offset length base linkrev nodeid p1 p2
23 0 0 69 0 1 6ca237634e1f 000000000000 000000000000
24 1 69 6 1 2 7a1ff8e75f5b 6ca237634e1f 000000000000
25 2 75 82 1 3 243dfe60f3d9 000000000000 000000000000
26 # should match
27 rev offset length base linkrev nodeid p1 p2
28 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
29 1 5 7 1 2 dd12c926cf16 2ed2a3912a0b 000000000000
30 renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
31 # should show no copies
32 n 644 6 08/28/05 05:00:19 bar
33 n 644 6 08/28/05 05:00:19 foo
34
@@ -141,6 +141,8 class dirstate:
141 st_size = kw.get('st_size', s.st_size)
141 st_size = kw.get('st_size', s.st_size)
142 st_mtime = kw.get('st_mtime', s.st_mtime)
142 st_mtime = kw.get('st_mtime', s.st_mtime)
143 self.map[f] = (state, s.st_mode, st_size, st_mtime)
143 self.map[f] = (state, s.st_mode, st_size, st_mtime)
144 if self.copies.has_key(f):
145 del self.copies[f]
144
146
145 def forget(self, files):
147 def forget(self, files):
146 if not files: return
148 if not files: return
@@ -59,7 +59,6 class filelog(revlog):
59
59
60 def renamed(self, node):
60 def renamed(self, node):
61 if 0 and self.parents(node)[0] != nullid:
61 if 0 and self.parents(node)[0] != nullid:
62 print "shortcut"
63 return False
62 return False
64 m = self.readmeta(node)
63 m = self.readmeta(node)
65 if m and m.has_key("copy"):
64 if m and m.has_key("copy"):
@@ -329,14 +329,16 class localrepository:
329 self.ui.warn("trouble committing %s!\n" % f)
329 self.ui.warn("trouble committing %s!\n" % f)
330 raise
330 raise
331
331
332 r = self.file(f)
333
332 meta = {}
334 meta = {}
333 cp = self.dirstate.copied(f)
335 cp = self.dirstate.copied(f)
334 if cp:
336 if cp:
335 meta["copy"] = cp
337 meta["copy"] = cp
336 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid)))
338 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid)))
337 self.ui.debug(" %s: copy %s:%s\n" % (f, cp, meta["copyrev"]))
339 self.ui.debug(" %s: copy %s:%s\n" % (f, cp, meta["copyrev"]))
338
340 fp1, fp2 = nullid, nullid
339 r = self.file(f)
341 else:
340 fp1 = m1.get(f, nullid)
342 fp1 = m1.get(f, nullid)
341 fp2 = m2.get(f, nullid)
343 fp2 = m2.get(f, nullid)
342
344
General Comments 0
You need to be logged in to leave comments. Login now