changeset 374:799b1d9de69c

:hg:`timestamps --save` now obeys given FILE parameters
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 05 Mar 2019 16:33:30 +0100
parents 1b65516842ca
children 8c340d172698
files extensions/timestamps.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/timestamps.py	Tue Mar 05 16:27:09 2019 +0100
+++ b/extensions/timestamps.py	Tue Mar 05 16:33:30 2019 +0100
@@ -178,6 +178,7 @@
     elif opts.get("save"):
         _save_timestamps(ui,
                          ctx,
+                         patsmatch,
                          tsconfig=opts.get("tsconfig"),
                          amend=opts.get("amend"))
     elif opts.get("restore"):
@@ -459,6 +460,7 @@
 
 def _save_timestamps(ui,
                      ctx,
+                     pats,
                      tsconfig=None,
                      amend=False):
     repo = ctx.repo()
@@ -476,9 +478,10 @@
         ts = _Timestamps.create(ui)
     with _FloatTimesInStat():
         for fn in ctx:
-            if tsconfmatch(fn):
-                st = os.lstat(repo.wjoin(fn))
-                ts[fn] = _to_isoformat(st.st_mtime)
+            if (pats is None) or pats(fn):
+                if tsconfmatch(fn):
+                    st = os.lstat(repo.wjoin(fn))
+                    ts[fn] = _to_isoformat(st.st_mtime)
     with io.open(repo.wjoin(TIMESTAMPS_DATABASE), "wb") as fp:
         ts.write(fp)