##// END OF EJS Templates
log: allow patterns with -f...
Durham Goode -
r21998:73909527 default
parent child Browse files
Show More
@@ -1570,8 +1570,14 b' def _makelogrevset(repo, pats, opts, rev'
1570 if not slowpath:
1570 if not slowpath:
1571 for f in match.files():
1571 for f in match.files():
1572 if follow and f not in pctx:
1572 if follow and f not in pctx:
1573 raise util.Abort(_('cannot follow file not in parent '
1573 # If the file exists, it may be a directory, so let it
1574 'revision: "%s"') % f)
1574 # take the slow path.
1575 if os.path.exists(repo.wjoin(f)):
1576 slowpath = True
1577 continue
1578 else:
1579 raise util.Abort(_('cannot follow file not in parent '
1580 'revision: "%s"') % f)
1575 filelog = repo.file(f)
1581 filelog = repo.file(f)
1576 if not filelog:
1582 if not filelog:
1577 # A zero count may be a directory or deleted file, so
1583 # A zero count may be a directory or deleted file, so
@@ -1595,9 +1601,6 b' def _makelogrevset(repo, pats, opts, rev'
1595 if slowpath:
1601 if slowpath:
1596 # See walkchangerevs() slow path.
1602 # See walkchangerevs() slow path.
1597 #
1603 #
1598 if follow:
1599 raise util.Abort(_('can only follow copies/renames for explicit '
1600 'filenames'))
1601 # pats/include/exclude cannot be represented as separate
1604 # pats/include/exclude cannot be represented as separate
1602 # revset expressions as their filtering logic applies at file
1605 # revset expressions as their filtering logic applies at file
1603 # level. For instance "-I a -X a" matches a revision touching
1606 # level. For instance "-I a -X a" matches a revision touching
@@ -1629,7 +1632,10 b' def _makelogrevset(repo, pats, opts, rev'
1629
1632
1630 filematcher = None
1633 filematcher = None
1631 if opts.get('patch') or opts.get('stat'):
1634 if opts.get('patch') or opts.get('stat'):
1632 if follow and not match.always():
1635 # When following files, track renames via a special matcher.
1636 # If we're forced to take the slowpath it means we're following
1637 # at least one pattern/directory, so don't bother with rename tracking.
1638 if follow and not match.always() and not slowpath:
1633 # _makelogfilematcher expects its files argument to be relative to
1639 # _makelogfilematcher expects its files argument to be relative to
1634 # the repo root, so use match.files(), not pats.
1640 # the repo root, so use match.files(), not pats.
1635 filematcher = _makelogfilematcher(repo, match.files(), followfirst)
1641 filematcher = _makelogfilematcher(repo, match.files(), followfirst)
@@ -1645,13 +1645,28 b' Test glob expansion of pats'
1645 ('symbol', 'filelog')
1645 ('symbol', 'filelog')
1646 ('string', 'aa'))))
1646 ('string', 'aa'))))
1647
1647
1648 Test --follow on a directory
1648 Test --follow on a non-existent directory
1649
1649
1650 $ testlog -f dir
1650 $ testlog -f dir
1651 abort: cannot follow file not in parent revision: "dir"
1651 abort: cannot follow file not in parent revision: "dir"
1652 abort: cannot follow file not in parent revision: "dir"
1652 abort: cannot follow file not in parent revision: "dir"
1653 abort: cannot follow file not in parent revision: "dir"
1653 abort: cannot follow file not in parent revision: "dir"
1654
1654
1655 Test --follow on a directory
1656
1657 $ hg up -q '.^'
1658 $ testlog -f dir
1659 []
1660 (group
1661 (func
1662 ('symbol', '_matchfiles')
1663 (list
1664 (list
1665 ('string', 'r:')
1666 ('string', 'd:relpath'))
1667 ('string', 'p:dir'))))
1668 $ hg up -q tip
1669
1655 Test --follow on file not in parent revision
1670 Test --follow on file not in parent revision
1656
1671
1657 $ testlog -f a
1672 $ testlog -f a
@@ -1662,9 +1677,15 b' Test --follow on file not in parent revi'
1662 Test --follow and patterns
1677 Test --follow and patterns
1663
1678
1664 $ testlog -f 'glob:*'
1679 $ testlog -f 'glob:*'
1665 abort: can only follow copies/renames for explicit filenames
1680 []
1666 abort: can only follow copies/renames for explicit filenames
1681 (group
1667 abort: can only follow copies/renames for explicit filenames
1682 (func
1683 ('symbol', '_matchfiles')
1684 (list
1685 (list
1686 ('string', 'r:')
1687 ('string', 'd:relpath'))
1688 ('string', 'p:glob:*'))))
1668
1689
1669 Test --follow on a single rename
1690 Test --follow on a single rename
1670
1691
@@ -1829,9 +1850,15 b' Test --removed'
1829 ('string', 'd:relpath'))
1850 ('string', 'd:relpath'))
1830 ('string', 'p:a'))))
1851 ('string', 'p:a'))))
1831 $ testlog --removed --follow a
1852 $ testlog --removed --follow a
1832 abort: can only follow copies/renames for explicit filenames
1853 []
1833 abort: can only follow copies/renames for explicit filenames
1854 (group
1834 abort: can only follow copies/renames for explicit filenames
1855 (func
1856 ('symbol', '_matchfiles')
1857 (list
1858 (list
1859 ('string', 'r:')
1860 ('string', 'd:relpath'))
1861 ('string', 'p:a'))))
1835
1862
1836 Test --patch and --stat with --follow and --follow-first
1863 Test --patch and --stat with --follow and --follow-first
1837
1864
@@ -78,12 +78,52 b' log on directory'
78 summary: c
78 summary: c
79
79
80
80
81 -f, directory
81 -f, non-existent directory
82
82
83 $ hg log -f dir
83 $ hg log -f dir
84 abort: cannot follow file not in parent revision: "dir"
84 abort: cannot follow file not in parent revision: "dir"
85 [255]
85 [255]
86
86
87 -f, directory
88
89 $ hg up -q 3
90 $ hg log -f dir
91 changeset: 2:f8954cd4dc1f
92 user: test
93 date: Thu Jan 01 00:00:03 1970 +0000
94 summary: c
95
96 -f, directory with --patch
97
98 $ hg log -f dir -p
99 changeset: 2:f8954cd4dc1f
100 user: test
101 date: Thu Jan 01 00:00:03 1970 +0000
102 summary: c
103
104 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
105 --- /dev/null* (glob)
106 +++ b/dir/b* (glob)
107 @@ -0,0 +1,1 @@
108 +a
109
110
111 -f, pattern
112
113 $ hg log -f -I 'dir**' -p
114 changeset: 2:f8954cd4dc1f
115 user: test
116 date: Thu Jan 01 00:00:03 1970 +0000
117 summary: c
118
119 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
120 --- /dev/null* (glob)
121 +++ b/dir/b* (glob)
122 @@ -0,0 +1,1 @@
123 +a
124
125 $ hg up -q 4
126
87 -f, a wrong style
127 -f, a wrong style
88
128
89 $ hg log -f -l1 --style something
129 $ hg log -f -l1 --style something
General Comments 0
You need to be logged in to leave comments. Login now