[PATCH] [mq:qrefresh] update help for --current-date

Martin Geisler mg at lazybytes.net
Mon Aug 3 03:57:27 CDT 2009

"Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr> writes:

> # HG changeset patch
> # User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
> # Date 1248937506 -7200
> # Node ID 1a87dc0bd797c8c6f1f438ffa42dcf0ef7a2a0a8
> # Parent  ac02b43bc08ae299bf77109fa71ffe6401d243ee
> [mq:qrefresh] update help for --current-date
> Using "qrefresh --current-date" only works if previously set
> with "qnew --current-date". Say so in the help text.

Thanks, but I think a better solution would be to fix the patchheader
class in mq and make the setuser and setdate methods behave the same:
"qrefresh -u" works even if the patch was not made with "qnew -u".

The code for the two methods:

    def setuser(self, user):
        if not self.updateheader(['From: ', '# User '], user):
                patchheaderat = self.comments.index('# HG changeset patch')
                self.comments.insert(patchheaderat + 1,'# User ' + user)
            except ValueError:
                self.comments = ['From: ' + user, ''] + self.comments
        self.user = user

    def setdate(self, date):
        if self.updateheader(['# Date '], date):
            self.date = date

It's clear that setdate is missing out on something :-)

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.

More information about the Mercurial-devel mailing list