[PATCH] Make annotate --follow an alias for -f/--file to behave like in older versions

Thomas Arendsen Hein thomas at intevation.de
Mon Mar 1 14:55:42 CST 2010


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Date 1267476703 -3600
# Branch stable
# Node ID dfd4be41cab6799e46bd38913179287d5b1d7842
# Parent  6505773080e43e01828a7ddd5caa7522ab4debe6
Make annotate --follow an alias for -f/--file to behave like in older versions

Since 98a0421b9e52 annotate follows copies/renames by default, but the output
of e.g. "annotate --follow --number" should not change without some
deprecation time.

diff -r 6505773080e4 -r dfd4be41cab6 mercurial/commands.py
--- a/mercurial/commands.py	Sun Feb 28 19:43:21 2010 +0100
+++ b/mercurial/commands.py	Mon Mar 01 21:51:43 2010 +0100
@@ -99,6 +99,11 @@
     anyway, although the results will probably be neither useful
     nor desirable.
     """
+    if opts.get('follow'):
+        # --follow is deprecated and now just an alias for -f/--file
+        # to mimic the behavior of Mercurial before version 1.5
+        opts['file'] = 1
+
     datefunc = ui.quiet and util.shortdate or util.datestr
     getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
 
@@ -3415,7 +3420,8 @@
     "^annotate|blame":
         (annotate,
          [('r', 'rev', '', _('annotate the specified revision')),
-          ('', 'follow', None, _('follow copies and renames (DEPRECATED)')),
+          ('', 'follow', None,
+           _('follow copies/renames and list the filename (DEPRECATED)')),
           ('', 'no-follow', None, _("don't follow copies and renames")),
           ('a', 'text', None, _('treat all files as text')),
           ('u', 'user', None, _('list the author (long with -v)')),
diff -r 6505773080e4 -r dfd4be41cab6 tests/test-annotate.out
--- a/tests/test-annotate.out	Sun Feb 28 19:43:21 2010 +0100
+++ b/tests/test-annotate.out	Mon Mar 01 21:51:43 2010 +0100
@@ -102,4 +102,4 @@
 1:3: a
 % generate ABA rename configuration
 % annotate after ABA with follow
-8: foo
+foo: foo


More information about the Mercurial-devel mailing list