Skip to content

RFE: Give Commit objects a replace method that returns new Commit with modified attributes #1123

@larsks

Description

@larsks

The datetime objects produced by Python's datetime module are immutable, much like Commit objects. The datetime module provides a convenient replace function that returns a new object based on an old with one or more attributes replaced. E.g, I can write:

>>> d = datetime.datetime.now()
>>> d.replace(hour=0, minute=0, second=0)
datetime.datetime(2021, 2, 15, 0, 0, 0, 318021)

I would like to see the same api on Commit objects, so that one could write:

>>> newcommit = oldcommit.replace(message='This is a test', author='Cookie Monster')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy