Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 31535: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 | 713e984bec91 |
children | 37a0ad669051 |
comparison
equal
deleted
inserted
replaced
31534:2abba5068aa1 | 31535:d0f95ecca2ad |
---|---|
1233 | 1233 |
1234 if command fails and onerr is None, return status, else raise onerr | 1234 if command fails and onerr is None, return status, else raise onerr |
1235 object as exception. | 1235 object as exception. |
1236 ''' | 1236 ''' |
1237 if blockedtag is None: | 1237 if blockedtag is None: |
1238 blockedtag = 'unknown_system_' + cmd.translate(None, _keepalnum) | 1238 # Long cmds tend to be because of an absolute path on cmd. Keep |
1239 # the tail end instead | |
1240 cmdsuffix = cmd.translate(None, _keepalnum)[-85:] | |
1241 blockedtag = 'unknown_system_' + cmdsuffix | |
1239 out = self.fout | 1242 out = self.fout |
1240 if any(s[1] for s in self._bufferstates): | 1243 if any(s[1] for s in self._bufferstates): |
1241 out = self | 1244 out = self |
1242 with self.timeblockedsection(blockedtag): | 1245 with self.timeblockedsection(blockedtag): |
1243 rc = self._runsystem(cmd, environ=environ, cwd=cwd, out=out) | 1246 rc = self._runsystem(cmd, environ=environ, cwd=cwd, out=out) |