[Yum-devel] [PATCH 1/2] Reuse .old() in .last(), and get complete_transactions_only for free
Tim Lauridsen
tim.lauridsen at googlemail.com
Wed Dec 23 08:47:44 UTC 2009
On Tue, Dec 22, 2009 at 8:37 PM, James Antill <james at and.org> wrote:
> ---
> yum/history.py | 25 ++++++++-----------------
> 1 files changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/yum/history.py b/yum/history.py
> index 5a1c5e0..5ef6960 100644
> --- a/yum/history.py
> +++ b/yum/history.py
> @@ -539,23 +539,14 @@ class YumHistory:
>
> return ret
>
> - def last(self):
> - """ This is the last full transaction. So any imcomplete
> transactions
> - do not count. """
> - cur = self._get_cursor()
> - sql = """SELECT tid,
> - trans_beg.timestamp AS beg_ts,
> - trans_beg.rpmdb_version AS beg_rv,
> - trans_end.timestamp AS end_ts,
> - trans_end.rpmdb_version AS end_rv,
> - loginuid, return_code
> - FROM trans_beg JOIN trans_end USING(tid)
> - ORDER BY beg_ts DESC, tid ASC
> - LIMIT 1"""
> - executeSQL(cur, sql)
> - for row in cur:
> - return YumHistoryTransaction(self, row)
> - return None
> + def last(self, complete_transactions_only=True):
> + """ This is the last full transaction. So any incomplete
> transactions
> + do not count, by default. """
> + ret = self.old([], 1, complete_transactions_only)
> + if not ret:
> + return None
> + assert len(ret) == 1
> + return ret[0]
>
> def _yieldSQLDataList(self, patterns, fields, ignore_case):
> """Yields all the package data for the given params. """
> --
> 1.6.5.2
>
> _______________________________________________
> Yum-devel mailing list
> Yum-devel at lists.baseurl.org
> http://lists.baseurl.org/mailman/listinfo/yum-devel
>
ACK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20091223/e9222112/attachment.htm>
More information about the Yum-devel
mailing list