changeset 3675:6990e499d71a

Revert almost all of 5be434785317; add a test Because of file copies, we should update the manifest dict only after committing all files.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 18 Nov 2006 19:44:42 -0200
parents 9103dab96093
children d94664748bc1
files mercurial/localrepo.py tests/test-commit-copy tests/test-commit-copy.out
diffstat 3 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Nov 18 11:34:19 2006 -0600
+++ b/mercurial/localrepo.py	Sat Nov 18 19:44:42 2006 -0200
@@ -646,15 +646,14 @@
         tr = self.transaction()
 
         # check in files
-        new = []
+        new = {}
         linkrev = self.changelog.count()
         commit.sort()
         for f in commit:
             self.ui.note(f + "\n")
             try:
-                m1[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
+                new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
                 m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
-                new.append(f)
             except IOError:
                 if use_dirstate:
                     self.ui.warn(_("trouble committing %s!\n") % f)
@@ -663,6 +662,7 @@
                     remove.append(f)
 
         # update manifest
+        m1.update(new)
         remove.sort()
 
         for f in remove:
@@ -671,6 +671,9 @@
         mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], (new, remove))
 
         # add changeset
+        new = new.keys()
+        new.sort()
+
         user = user or self.ui.username()
         if not text or force_editor:
             edittext = []
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-commit-copy	Sat Nov 18 19:44:42 2006 -0200
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+hg init dir
+cd dir
+echo bleh > bar
+hg add bar
+hg ci -m 'add bar'
+
+hg cp bar foo
+echo >> bar
+hg ci -m 'cp bar foo; change bar'
+
+hg debugrename foo
+hg debugindex .hg/data/bar.i
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-commit-copy.out	Sat Nov 18 19:44:42 2006 -0200
@@ -0,0 +1,4 @@
+foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9
+   rev    offset  length   base linkrev nodeid       p1           p2
+     0         0       6      0       0 26d3ca0dfd18 000000000000 000000000000
+     1         6       7      1       1 d267bddd54f7 26d3ca0dfd18 000000000000