changeset 31541:d0f95ecca2ad

ui: restrict length of autogenerated blocked tags Long autogenerated blocked tags tend to be because the command has an absolute path; at Facebook, we've had a few where the tag is thousands of characters long (in association with the mergedriver). Change the default to use a suffix of a command as the default tag, limiting us to 85 characters (for a 100 character tag). This is long enough to overflow a standard terminal (thus be obviously autogenerated), but short enough to be readable.
author Simon Farnsworth <simonfar@fb.com>
date Mon, 20 Mar 2017 05:08:21 -0700
parents 2abba5068aa1
children 48b9c9ca09b7
files mercurial/ui.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Mar 19 01:20:08 2017 -0400
+++ b/mercurial/ui.py	Mon Mar 20 05:08:21 2017 -0700
@@ -1235,7 +1235,10 @@
         object as exception.
         '''
         if blockedtag is None:
-            blockedtag = 'unknown_system_' + cmd.translate(None, _keepalnum)
+            # Long cmds tend to be because of an absolute path on cmd. Keep
+            # the tail end instead
+            cmdsuffix = cmd.translate(None, _keepalnum)[-85:]
+            blockedtag = 'unknown_system_' + cmdsuffix
         out = self.fout
         if any(s[1] for s in self._bufferstates):
             out = self