Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a814533d
Commit
a814533d
authored
Jan 27, 2014
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #19966: allow hgtouch to operate on a base dir that is != the repo root.
parent
92b1382c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
Tools/hg/hgtouch.py
Tools/hg/hgtouch.py
+23
-12
No files found.
Tools/hg/hgtouch.py
View file @
a814533d
...
@@ -36,12 +36,16 @@ def parse_config(repo):
...
@@ -36,12 +36,16 @@ def parse_config(repo):
result
[
o
]
=
inputs
result
[
o
]
=
inputs
return
result
return
result
def
check_rule
(
ui
,
repo
,
modified
,
output
,
inputs
):
def
check_rule
(
ui
,
repo
,
modified
,
basedir
,
output
,
inputs
):
"""Verify that the output is newer than any of the inputs.
"""Verify that the output is newer than any of the inputs.
Return (status, stamp), where status is True if the update succeeded,
Return (status, stamp), where status is True if the update succeeded,
and stamp is the newest time stamp assigned to any file (might be in
and stamp is the newest time stamp assigned to any file (might be in
the future)."""
the future).
f_output
=
repo
.
wjoin
(
output
)
If basedir is nonempty, it gives a directory in which the tree is to
be checked.
"""
f_output
=
repo
.
wjoin
(
os
.
path
.
join
(
basedir
,
output
))
try
:
try
:
o_time
=
os
.
stat
(
f_output
).
st_mtime
o_time
=
os
.
stat
(
f_output
).
st_mtime
except
OSError
:
except
OSError
:
...
@@ -51,7 +55,7 @@ def check_rule(ui, repo, modified, output, inputs):
...
@@ -51,7 +55,7 @@ def check_rule(ui, repo, modified, output, inputs):
backdate
=
None
backdate
=
None
backdate_source
=
None
backdate_source
=
None
for
i
in
inputs
:
for
i
in
inputs
:
f_i
=
repo
.
wjoin
(
i
)
f_i
=
repo
.
wjoin
(
os
.
path
.
join
(
basedir
,
i
)
)
try
:
try
:
i_time
=
os
.
stat
(
f_i
).
st_mtime
i_time
=
os
.
stat
(
f_i
).
st_mtime
except
OSError
:
except
OSError
:
...
@@ -79,7 +83,13 @@ def check_rule(ui, repo, modified, output, inputs):
...
@@ -79,7 +83,13 @@ def check_rule(ui, repo, modified, output, inputs):
# Nothing to update
# Nothing to update
return
True
,
0
return
True
,
0
def
do_touch
(
ui
,
repo
):
def
do_touch
(
ui
,
repo
,
basedir
):
if
basedir
:
if
not
os
.
path
.
isdir
(
repo
.
wjoin
(
basedir
)):
ui
.
warn
(
"Abort: basedir %r does not exist
\
n
"
%
basedir
)
return
modified
=
[]
else
:
modified
=
repo
.
status
()[
0
]
modified
=
repo
.
status
()[
0
]
dependencies
=
parse_config
(
repo
)
dependencies
=
parse_config
(
repo
)
success
=
True
success
=
True
...
@@ -93,8 +103,8 @@ def do_touch(ui, repo):
...
@@ -93,8 +103,8 @@ def do_touch(ui, repo):
if
i
in
dependencies
:
if
i
in
dependencies
:
hold_back
[
output
]
=
inputs
hold_back
[
output
]
=
inputs
continue
continue
_success
,
_tstamp
=
check_rule
(
ui
,
repo
,
modified
,
output
,
inputs
)
_success
,
_tstamp
=
check_rule
(
ui
,
repo
,
modified
,
basedir
,
output
,
inputs
)
sucess
=
success
and
_success
suc
c
ess
=
success
and
_success
tstamp
=
max
(
tstamp
,
_tstamp
)
tstamp
=
max
(
tstamp
,
_tstamp
)
# put back held back rules
# put back held back rules
dependencies
.
update
(
hold_back
)
dependencies
.
update
(
hold_back
)
...
@@ -109,11 +119,12 @@ def do_touch(ui, repo):
...
@@ -109,11 +119,12 @@ def do_touch(ui, repo):
return
False
return
False
return
success
return
success
def
touch
(
ui
,
repo
):
def
touch
(
ui
,
repo
,
basedir
):
"touch generated files that are older than their sources after an update."
"touch generated files that are older than their sources after an update."
do_touch
(
ui
,
repo
)
do_touch
(
ui
,
repo
,
basedir
)
cmdtable
=
{
cmdtable
=
{
"touch"
:
(
touch
,
[],
"touch"
:
(
touch
,
"touch generated files according to the .hgtouch configuration"
)
[(
'b'
,
'basedir'
,
''
,
'base dir of the tree to apply touching'
,
'BASEDIR'
)],
"hg touch [-b BASEDIR]"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment