[PATCH 4 of 4] largefiles: simplify check for lack of path arguments

Martin von Zweigbergk martinvonz at google.com
Sun Nov 2 15:43:16 CST 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1414963088 28800
#      Sun Nov 02 13:18:08 2014 -0800
# Branch stable
# Node ID 3df2c5d179ddcd2ff0a1edca410ff2139725e210
# Parent  b89ddc59955d4ffc106c8566af52111f7d52f718
largefiles: simplify check for lack of path arguments

Instead of checking for a partial merge by checking that the matches
has no files and no patterns, check that it's not an
always-matcher. Except for being shorter, it also catches the rare
case of an exact-matcher with no files.

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -284,8 +284,7 @@
                 # Case 1: user calls commit with no specific files or
                 # include/exclude patterns: refresh and commit all files that
                 # are "dirty".
-                if ((match is None) or
-                    (not match.anypats() and not match.files())):
+                if match is None or match.always():
                     # Spend a bit of time here to get a list of files we know
                     # are modified so we can compare only against those.
                     # It can cost a lot of time (several seconds)


More information about the Mercurial-devel mailing list