changeset 23404:b913c394386f

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Nov 2014 12:25:01 -0600
parents fd5247a88e63 (current diff) edf29f9c15f0 (diff)
children 2a038deeac9a
files mercurial/cmdutil.py mercurial/commands.py mercurial/context.py tests/test-commandserver.t tests/test-help.t tests/test-revert.t
diffstat 12 files changed, 97 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Nov 11 20:32:10 2014 -0800
+++ b/mercurial/cmdutil.py	Thu Nov 27 12:25:01 2014 -0600
@@ -2615,12 +2615,16 @@
             dsmodified = modified
             dsadded = added
             dsremoved = removed
+            # store all local modifications, useful later for rename detection
+            localchanges = dsmodified | dsadded
             modified, added, removed = set(), set(), set()
         else:
             changes = repo.status(node1=parent, match=m)
             dsmodified = set(changes.modified)
             dsadded    = set(changes.added)
             dsremoved  = set(changes.removed)
+            # store all local modifications, useful later for rename detection
+            localchanges = dsmodified | dsadded
 
             # only take into account for removes between wc and target
             clean |= dsremoved - removed
@@ -2654,7 +2658,7 @@
 
         # if f is a rename, update `names` to also revert the source
         cwd = repo.getcwd()
-        for f in dsadded:
+        for f in localchanges:
             src = repo.dirstate.copied(f)
             # XXX should we check for rename down to target node?
             if src and src not in names and repo.dirstate[src] == 'r':
--- a/mercurial/commands.py	Tue Nov 11 20:32:10 2014 -0800
+++ b/mercurial/commands.py	Thu Nov 27 12:25:01 2014 -0600
@@ -4524,7 +4524,7 @@
      ] + mergetoolopts,
     _('[-P] [-f] [[-r] REV]'))
 def merge(ui, repo, node=None, **opts):
-    """merge working directory with another revision
+    """merge another revision into working directory
 
     The current working directory is updated with all changes made in
     the requested revision since the last common predecessor revision.
--- a/mercurial/context.py	Tue Nov 11 20:32:10 2014 -0800
+++ b/mercurial/context.py	Thu Nov 27 12:25:01 2014 -0600
@@ -1037,15 +1037,16 @@
     def _manifest(self):
         """generate a manifest corresponding to the values in self._status"""
 
-        man = self._parents[0].manifest().copy()
+        man1 = self._parents[0].manifest()
+        man = man1.copy()
         if len(self._parents) > 1:
             man2 = self.p2().manifest()
             def getman(f):
-                if f in man:
-                    return man
+                if f in man1:
+                    return man1
                 return man2
         else:
-            getman = lambda f: man
+            getman = lambda f: man1
 
         copied = self._repo.dirstate.copies()
         ff = self._flagfunc
@@ -1310,8 +1311,10 @@
         else:
             wlock = self._repo.wlock()
             try:
-                if self._repo.dirstate[dest] in '?r':
+                if self._repo.dirstate[dest] in '?':
                     self._repo.dirstate.add(dest)
+                elif self._repo.dirstate[dest] in 'r':
+                    self._repo.dirstate.normallookup(dest)
                 self._repo.dirstate.copy(source, dest)
             finally:
                 wlock.release()
--- a/tests/test-alias.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-alias.t	Thu Nov 27 12:25:01 2014 -0600
@@ -443,7 +443,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
@@ -469,7 +469,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
@@ -495,7 +495,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
--- a/tests/test-commandserver.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-commandserver.t	Thu Nov 27 12:25:01 2014 -0600
@@ -68,7 +68,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
--- a/tests/test-globalopts.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-globalopts.t	Thu Nov 27 12:25:01 2014 -0600
@@ -315,7 +315,7 @@
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
    manifest      output the current or given revision of the project manifest
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    outgoing      show changesets not found in the destination
    paths         show aliases for remote repositories
    phase         set or show the current phase name
@@ -396,7 +396,7 @@
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
    manifest      output the current or given revision of the project manifest
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    outgoing      show changesets not found in the destination
    paths         show aliases for remote repositories
    phase         set or show the current phase name
--- a/tests/test-help.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-help.t	Thu Nov 27 12:25:01 2014 -0600
@@ -14,7 +14,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
@@ -35,7 +35,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
@@ -78,7 +78,7 @@
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
    manifest      output the current or given revision of the project manifest
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    outgoing      show changesets not found in the destination
    paths         show aliases for remote repositories
    phase         set or show the current phase name
@@ -153,7 +153,7 @@
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
    manifest      output the current or given revision of the project manifest
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    outgoing      show changesets not found in the destination
    paths         show aliases for remote repositories
    phase         set or show the current phase name
@@ -293,7 +293,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log, history  show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove, rm    remove the specified files on the next commit
@@ -600,7 +600,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit
@@ -695,7 +695,7 @@
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
    manifest      output the current or given revision of the project manifest
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    outgoing      show changesets not found in the destination
    paths         show aliases for remote repositories
    phase         set or show the current phase name
@@ -1363,7 +1363,7 @@
   merge
   </a>
   </td><td>
-  merge working directory with another revision
+  merge another revision into working directory
   </td></tr>
   <tr><td>
   <a href="/help/pull">
--- a/tests/test-mq-qrename.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-mq-qrename.t	Thu Nov 27 12:25:01 2014 -0600
@@ -76,8 +76,8 @@
   $ hg qrename patchb patchc
   $ hg qrename patcha patchb
   $ hg st --mq
+  M patchb
   M series
-  A patchb
   A patchc
   R patcha
   $ cd ..
--- a/tests/test-rename.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-rename.t	Thu Nov 27 12:25:01 2014 -0600
@@ -571,20 +571,30 @@
   $ hg rename d1/a d1/c
   $ hg rename d1/b d1/a
   $ hg status -C
-  A d1/a
+  M d1/a
     d1/b
   A d1/c
     d1/a
   R d1/b
   $ hg diff --git
-  diff --git a/d1/b b/d1/a
-  rename from d1/b
-  rename to d1/a
+  diff --git a/d1/a b/d1/a
+  --- a/d1/a
+  +++ b/d1/a
+  @@ -1,1 +1,1 @@
+  -d1/a
+  +d1/b
+  diff --git a/d1/b b/d1/b
+  deleted file mode 100644
+  --- a/d1/b
+  +++ /dev/null
+  @@ -1,1 +0,0 @@
+  -d1/b
   diff --git a/d1/a b/d1/c
   copy from d1/a
   copy to d1/c
   $ hg update -C
-  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm d1/c # The file was marked as added, so 'hg update' action  was 'forget'
 
 check illegal path components
 
--- a/tests/test-revert.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-revert.t	Thu Nov 27 12:25:01 2014 -0600
@@ -234,6 +234,12 @@
   $ hg st a newa
   ? newa
 
+Also true for move overwriting an existing file
+
+  $ hg mv --force a b/b
+  $ hg revert b/b
+  $ hg status a b/b
+
   $ cd ..
 
   $ hg init ignored
--- a/tests/test-status.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-status.t	Thu Nov 27 12:25:01 2014 -0600
@@ -390,3 +390,49 @@
 #endif
 
   $ cd ..
+
+Status after move overwriting a file (issue4458)
+=================================================
+
+
+  $ hg init issue4458
+  $ cd issue4458
+  $ echo a > a
+  $ echo b > b
+  $ hg commit -Am base
+  adding a
+  adding b
+
+
+with --force
+
+  $ hg mv b --force a
+  $ hg st --copies
+  M a
+    b
+  R b
+  $ hg revert --all
+  reverting a
+  undeleting b
+  $ rm *.orig
+
+without force
+
+  $ hg rm a
+  $ hg st --copies
+  R a
+  $ hg mv b a
+  $ hg st --copies
+  M a
+    b
+  R b
+
+Other "bug" highlight, the revision status does not report the copy information.
+This is buggy behavior.
+
+  $ hg commit -m 'blah'
+  $ hg st --copies --change .
+  M a
+  R b
+
+  $ cd ..
--- a/tests/test-strict.t	Tue Nov 11 20:32:10 2014 -0800
+++ b/tests/test-strict.t	Thu Nov 27 12:25:01 2014 -0600
@@ -28,7 +28,7 @@
    forget        forget the specified files on the next commit
    init          create a new repository in the given directory
    log           show revision history of entire repository or files
-   merge         merge working directory with another revision
+   merge         merge another revision into working directory
    pull          pull changes from the specified source
    push          push changes to the specified destination
    remove        remove the specified files on the next commit