Hi!
Attached is a patch that implements --sign and friends on push.
Patch is against 1.0.5rc1-tag. I also list some reasoning why
this is needed. This and the Windows GPG fix patch are also
available in temporary repo at
http://darcs.tamelambda.net/repo/temp/darcs/
All tests pass on Linux i686, and same results as before patches
in Windows.
I've been working on http-push for darcs, but there is a hurdle
on how to make it easy and consistent for user. At the moment,
my DARCS_APPLY_HTTP-program invokes gpg, and it works fine,
but sometimes there is no need for signing (for example when
pushing into lan-only http server, or via vpn.)
There are at least following solutions I could have done, also.
* Use send --sendmail-command, but that "feels" wrong, I am not
sending email, as the command implies. And using
--sendmail-command is a lot more package to write. Or
a lot of preferences to set (on *many* repositories in my
case). Also in my tests it doesn't work in Windows, and
it wasn't apparent to me why it didn't.
* Change DARCS_APPLY_HTTP depending on repo I happen to
work in, yeah, but just as cumbersome as send --sendmail-command.
* Implement a way to pass parameters to DARCS_APPLY_FOO,
I didn't implement it, because I have no idea if someone
else has use for it, and it (probably) results in less
intuitive and less consistent user interface in my case.
* Use different DARCS_APPLY_FOO; DARCS_APPLY_HTTPSIGN and
DARCS_APPLY_HTTP. This choice actually isn't that bad, but
after getting http-push work as it does now, it seems something
extra I don't need. This is clearly my backup-option.
I'd love to hear comments/discussion on this. Given Darcs'
flexibility, there are a lot of ways to build a solution, but
it is less clear if one of them is the best.
Naturally, any comments about actual patch are also welcome. :-)
Best regards,
--Esa
New patches:
[Support signed push
Esa Ilari Vuokko <ei@xxxxxxxxxxx>**20051129082159] {
hunk ./Push.lhs 23
-import DarcsArguments ( DarcsFlag( DryRun, Verbose, Quiet ),
+import DarcsArguments ( DarcsFlag( DryRun, Verbose, Quiet, Sign, SignAs,
NoSign, SignSSL ),
hunk ./Push.lhs 28
- any_verbosity, set_default,
+ any_verbosity, set_default, sign
hunk ./Push.lhs 34
-import External ( maybeURLCmd )
+import External ( maybeURLCmd, signString )
hunk ./Push.lhs 73
- applyas, dry_run, summary,
+ applyas, sign, dry_run, summary,
hunk ./Push.lhs 95
- when (is_url repodir) $ do
+ if is_url repodir then do
hunk ./Push.lhs 113
+ else do
+ when (want_sign opts) $
+ let msg = text "Signing doesn't make sense for local repositories or
when pushing over ssh."
+ in if DryRun `elem` opts
+ then putInfo $ text "NOTE:" <+> msg
+ else errorDoc msg
hunk ./Push.lhs 145
- out <- remote_apply opts repodir bundle
+ out <- remote_apply opts repodir =<< signString opts bundle
hunk ./Push.lhs 149
+\begin{code}
+want_sign :: [DarcsFlag] -> Bool
+want_sign opts = case opts of
+ [] -> False
+ Sign:_ -> True
+ (SignAs _):_ -> True
+ (SignSSL _):_ -> True
+ NoSign:_ -> False
+ _:opts' -> want_sign opts'
+\end{code}
}
Context:
[TAG 1.0.5rc1
Tommy Pettersson <ptp@xxxxxxxxxxxxxx>**20051125191739]
Patch bundle hash:
014fb4cd6d0995ea11261cbf01cab2ced9c35877
_______________________________________________
darcs-devel mailing list
darcs-devel@xxxxxxxxx
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel
|