Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding search option to log along with test case #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion svn/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def cat(self, rel_filepath, revision=None):
def log_default(self, timestamp_from_dt=None, timestamp_to_dt=None,
limit=None, rel_filepath=None, stop_on_copy=False,
revision_from=None, revision_to=None, changelist=False,
use_merge_history=False):
use_merge_history=False, search=None):
"""Allow for the most-likely kind of log listing: the complete list,
a FROM and TO timestamp, a FROM timestamp only, or a quantity limit.
"""
Expand Down Expand Up @@ -230,6 +230,9 @@ def log_default(self, timestamp_from_dt=None, timestamp_to_dt=None,
if stop_on_copy is True:
args += ['--stop-on-copy']

if search is not None:
args += ['--search', search]

if use_merge_history is True:
args += ['--use-merge-history']

Expand Down
2 changes: 1 addition & 1 deletion svn/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ content = l.cat('test_file')
```


### log_default(timestamp_from_dt=None, timestamp_to_dt=None, limit=None, rel_filepath='', stop_on_copy=False, revision_from=None, revision_to=None, changelist=False)
### log_default(timestamp_from_dt=None, timestamp_to_dt=None, limit=None, rel_filepath=None, stop_on_copy=False, revision_from=None, revision_to=None, changelist=False, use_merge_history=False, search=None)

Perform a log-listing that can be bounded by time or revision number and/or
take a maximum-count.
Expand Down
11 changes: 11 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ def test_log(self):
self.assertEquals(l.revision, 1)
self.assertEquals(l.msg, 'Initial commit.')

def test_search(self):
with svn.test_support.temp_common() as (_, _, cc):
svn.test_support.populate_bigger_file_changes1()
svn.test_support.populate_bigger_file_change1()
actual = \
cc.log_default(search="Change file", revision_from=1, revision_to=2)
self.assertEqual(next(actual).revision, 2)
actual = \
cc.log_default(search="Initial", revision_from=1, revision_to=2)
self.assertEqual(next(actual).revision, 1)

def test_cat(self):
with svn.test_support.temp_common() as (_, _, cc):
svn.test_support.populate_bigger_file_changes1()
Expand Down