Show More
@@ -279,10 +279,11 b' def _makelogrevset(repo, pats, opts, rev' | |||||
279 | the files to be detailed when displaying the revision. |
|
279 | the files to be detailed when displaying the revision. | |
280 | """ |
|
280 | """ | |
281 | opt2revset = { |
|
281 | opt2revset = { | |
282 | 'follow': ('follow()', None), |
|
|||
283 | 'follow_first': ('_followfirst()', None), |
|
282 | 'follow_first': ('_followfirst()', None), | |
284 | 'no_merges': ('not merge()', None), |
|
283 | 'no_merges': ('not merge()', None), | |
285 | 'only_merges': ('merge()', None), |
|
284 | 'only_merges': ('merge()', None), | |
|
285 | '_ancestors': ('ancestors(%(val)s)', None), | |||
|
286 | '_descendants': ('descendants(%(val)s)', None), | |||
286 | '_matchfiles': ('_matchfiles(%(val)s)', None), |
|
287 | '_matchfiles': ('_matchfiles(%(val)s)', None), | |
287 | 'date': ('date(%(val)r)', None), |
|
288 | 'date': ('date(%(val)r)', None), | |
288 | 'branch': ('branch(%(val)r)', ' or '), |
|
289 | 'branch': ('branch(%(val)r)', ' or '), | |
@@ -298,10 +299,11 b' def _makelogrevset(repo, pats, opts, rev' | |||||
298 | # follow or not follow? |
|
299 | # follow or not follow? | |
299 | follow = opts.get('follow') or opts.get('follow_first') |
|
300 | follow = opts.get('follow') or opts.get('follow_first') | |
300 | followfirst = opts.get('follow_first') |
|
301 | followfirst = opts.get('follow_first') | |
301 | if 'follow' in opts: |
|
|||
302 | del opts['follow'] |
|
|||
303 | if 'follow_first' in opts: |
|
302 | if 'follow_first' in opts: | |
304 | del opts['follow_first'] |
|
303 | del opts['follow_first'] | |
|
304 | # --follow with FILE behaviour depends on revs... | |||
|
305 | startrev = revs[0] | |||
|
306 | followdescendants = len(revs) > 1 and revs[0] < revs[1] | |||
305 |
|
307 | |||
306 | # branch and only_branch are really aliases and must be handled at |
|
308 | # branch and only_branch are really aliases and must be handled at | |
307 | # the same time |
|
309 | # the same time | |
@@ -359,7 +361,10 b' def _makelogrevset(repo, pats, opts, rev' | |||||
359 | if pats: |
|
361 | if pats: | |
360 | opts['_patsfollow'] = list(pats) |
|
362 | opts['_patsfollow'] = list(pats) | |
361 | else: |
|
363 | else: | |
362 |
|
|
364 | if followdescendants: | |
|
365 | opts['_descendants'] = str(startrev) | |||
|
366 | else: | |||
|
367 | opts['_ancestors'] = str(startrev) | |||
363 | else: |
|
368 | else: | |
364 | opts['_patslog'] = list(pats) |
|
369 | opts['_patslog'] = list(pats) | |
365 |
|
370 | |||
@@ -402,10 +407,16 b' def getlogrevs(repo, pats, opts):' | |||||
402 | """ |
|
407 | """ | |
403 | if not len(repo): |
|
408 | if not len(repo): | |
404 | return [], None, None |
|
409 | return [], None, None | |
|
410 | # Default --rev value depends on --follow but --follow behaviour | |||
|
411 | # depends on revisions resolved from --rev... | |||
|
412 | follow = opts.get('follow') or opts.get('follow_first') | |||
405 | if opts.get('rev'): |
|
413 | if opts.get('rev'): | |
406 | revs = scmutil.revrange(repo, opts['rev']) |
|
414 | revs = scmutil.revrange(repo, opts['rev']) | |
407 | else: |
|
415 | else: | |
408 |
|
|
416 | if follow and len(repo) > 0: | |
|
417 | revs = scmutil.revrange(repo, ['.:0']) | |||
|
418 | else: | |||
|
419 | revs = range(len(repo) - 1, -1, -1) | |||
409 | if not revs: |
|
420 | if not revs: | |
410 | return [], None, None |
|
421 | return [], None, None | |
411 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) |
|
422 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) |
@@ -1538,13 +1538,13 b' have 2 filelog topological heads in a li' | |||||
1538 | $ cd .. |
|
1538 | $ cd .. | |
1539 | $ hg init follow |
|
1539 | $ hg init follow | |
1540 | $ cd follow |
|
1540 | $ cd follow | |
|
1541 | $ testlog --follow | |||
|
1542 | [] | |||
|
1543 | [] | |||
1541 | $ echo a > a |
|
1544 | $ echo a > a | |
1542 | $ echo aa > aa |
|
1545 | $ echo aa > aa | |
1543 | $ echo f > f |
|
1546 | $ echo f > f | |
1544 | $ hg ci -Am "add a" |
|
1547 | $ hg ci -Am "add a" a aa f | |
1545 | adding a |
|
|||
1546 | adding aa |
|
|||
1547 | adding f |
|
|||
1548 | $ hg cp a b |
|
1548 | $ hg cp a b | |
1549 | $ hg cp f g |
|
1549 | $ hg cp f g | |
1550 | $ hg ci -m "copy a b" |
|
1550 | $ hg ci -m "copy a b" | |
@@ -1925,3 +1925,54 b' Test old-style --rev' | |||||
1925 | $ testlog -r 'foo-bar' |
|
1925 | $ testlog -r 'foo-bar' | |
1926 | ['foo-bar'] |
|
1926 | ['foo-bar'] | |
1927 | [] |
|
1927 | [] | |
|
1928 | ||||
|
1929 | Test --follow and forward --rev | |||
|
1930 | ||||
|
1931 | $ hg up -q 6 | |||
|
1932 | $ echo g > g | |||
|
1933 | $ hg ci -Am 'add g' g | |||
|
1934 | created new head | |||
|
1935 | $ hg up -q 2 | |||
|
1936 | $ hg log -G --template "{rev} {desc|firstline}\n" | |||
|
1937 | o 8 add g | |||
|
1938 | | | |||
|
1939 | | o 7 Added tag foo-bar for changeset fc281d8ff18d | |||
|
1940 | |/ | |||
|
1941 | o 6 merge 5 and 4 | |||
|
1942 | |\ | |||
|
1943 | | o 5 add another e | |||
|
1944 | | | | |||
|
1945 | o | 4 mv dir/b e | |||
|
1946 | |/ | |||
|
1947 | o 3 mv a b; add d | |||
|
1948 | | | |||
|
1949 | @ 2 mv b dir/b | |||
|
1950 | | | |||
|
1951 | o 1 copy a b | |||
|
1952 | | | |||
|
1953 | o 0 add a | |||
|
1954 | ||||
|
1955 | $ testlog --follow -r6 -r8 -r5 -r7 -r4 | |||
|
1956 | ['6', '8', '5', '7', '4'] | |||
|
1957 | (group | |||
|
1958 | (func | |||
|
1959 | ('symbol', 'descendants') | |||
|
1960 | ('symbol', '6'))) | |||
|
1961 | --- log.nodes * (glob) | |||
|
1962 | +++ glog.nodes * (glob) | |||
|
1963 | @@ -1,3 +1,3 @@ | |||
|
1964 | -nodetag 6 | |||
|
1965 | nodetag 8 | |||
|
1966 | nodetag 7 | |||
|
1967 | +nodetag 6 | |||
|
1968 | [1] | |||
|
1969 | ||||
|
1970 | Test --follow and backward --rev | |||
|
1971 | ||||
|
1972 | $ testlog --follow -r6 -r5 -r7 -r8 -r4 | |||
|
1973 | ['6', '5', '7', '8', '4'] | |||
|
1974 | (group | |||
|
1975 | (func | |||
|
1976 | ('symbol', 'ancestors') | |||
|
1977 | ('symbol', '6'))) | |||
|
1978 |
General Comments 0
You need to be logged in to leave comments.
Login now