Merge with -crew
authorMatt Mackall <mpm@selenic.com>
Mon, 20 Aug 2007 21:14:53 -0500
changeset 5208 cf9226452db7
parent 5202 1108c952cca1 (current diff)
parent 5207 212de429e000 (diff)
child 5209 bbdcdc7f170e
Merge with -crew
tests/test-add
--- a/hgext/convert/__init__.py	Sun Aug 19 14:04:26 2007 -0500
+++ b/hgext/convert/__init__.py	Mon Aug 20 21:14:53 2007 -0500
@@ -81,10 +81,9 @@
             n = visit.pop(0)
             if n in known or n in self.map: continue
             known[n] = 1
-            self.commitcache[n] = self.source.getcommit(n)
-            cp = self.commitcache[n].parents
+            commit = self.cachecommit(n)
             parents[n] = []
-            for p in cp:
+            for p in commit.parents:
                 parents[n].append(p)
                 visit.append(p)
 
@@ -188,6 +187,12 @@
                     % (authorfile, line))
         afile.close()
 
+    def cachecommit(self, rev):
+        commit = self.source.getcommit(rev)
+        commit.author = self.authors.get(commit.author, commit.author)
+        self.commitcache[rev] = commit
+        return commit
+
     def copy(self, rev):
         commit = self.commitcache[rev]
         do_copies = hasattr(self.dest, 'copyfile')
@@ -196,7 +201,10 @@
         files, copies = self.source.getchanges(rev)
         parents = [self.map[r] for r in commit.parents]
         if commit.parents:
-            pbranch = self.commitcache[commit.parents[0]].branch
+            prev = commit.parents[0]
+            if prev not in self.commitcache:
+                self.cachecommit(prev)
+            pbranch = self.commitcache[prev].branch
         else:
             pbranch = None
         self.dest.setbranch(commit.branch, pbranch, parents)
@@ -243,9 +251,6 @@
                 desc = self.commitcache[c].desc
                 if "\n" in desc:
                     desc = desc.splitlines()[0]
-                author = self.commitcache[c].author
-                author = self.authors.get(author, author)
-                self.commitcache[c].author = author
                 self.ui.status("%d %s\n" % (num, desc))
                 self.copy(c)
 
--- a/mercurial/commands.py	Sun Aug 19 14:04:26 2007 -0500
+++ b/mercurial/commands.py	Mon Aug 20 21:14:53 2007 -0500
@@ -1567,8 +1567,10 @@
                 data = patch.extract(ui, sys.stdin)
             else:
                 ui.status(_("applying %s\n") % p)
-                data = patch.extract(ui, file(pf, 'rb'))
-
+                if os.path.exists(pf):
+                    data = patch.extract(ui, file(pf, 'rb'))
+                else:
+                    data = patch.extract(ui, urllib.urlopen(pf))
             tmpname, message, user, date, branch, nodeid, p1, p2 = data
 
             if tmpname is None:
--- a/mercurial/localrepo.py	Sun Aug 19 14:04:26 2007 -0500
+++ b/mercurial/localrepo.py	Mon Aug 20 21:14:53 2007 -0500
@@ -995,8 +995,10 @@
                 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
                     self.ui.warn(_("%s not added: only files and symlinks "
                                    "supported currently\n") % f)
-                elif self.dirstate[f] in 'an':
+                elif self.dirstate[f] in 'amn':
                     self.ui.warn(_("%s already tracked!\n") % f)
+                elif self.dirstate[f] == 'r':
+                    self.dirstate.normaldirty(f)
                 else:
                     self.dirstate.add(f)
         finally:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-add	Mon Aug 20 21:14:53 2007 -0500
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+hg init a
+cd a
+echo a > a
+hg add -n
+hg st
+hg add
+hg st
+
+echo b > b
+hg add -n b
+hg st
+hg add b
+hg st
+echo % should fail
+hg add b
+hg st
+
+hg ci -m 0
+echo % should fail
+hg add a
+
+echo aa > a
+hg ci -m 1
+hg up 0
+echo aaa > a
+hg ci -m 2
+
+hg merge
+hg st
+echo % should fail
+hg add a
+hg st
+hg ci -m merge
+
+echo % issue683
+hg rm a
+hg st
+echo a > a
+hg add a
+hg st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-add.out	Mon Aug 20 21:14:53 2007 -0500
@@ -0,0 +1,29 @@
+adding a
+? a
+adding a
+A a
+A a
+? b
+A a
+A b
+% should fail
+b already tracked!
+A a
+A b
+% should fail
+a already tracked!
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+warning: conflicts during merge.
+merging a
+merging a failed!
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+There are unresolved merges, you can redo the full merge using:
+  hg update -C 2
+  hg merge 1
+M a
+% should fail
+a already tracked!
+M a
+% issue683
+R a
+M a