remove: Remove --euc flag from patch send command and use the repo euc
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Remove the `--repo` option and make the repo an argument - by Awiteb
|
||||
- Remove the `--to` flag from `reply` command and make it an argument - by Awiteb
|
||||
- Remove `--euc` flag from `patch send` command and use the repo euc - by Awiteb
|
||||
|
||||
## [0.2.0] - 2025-06-01
|
||||
|
||||
|
||||
@@ -58,12 +58,6 @@ pub struct SendArgs {
|
||||
/// `nostr:npub1...`.
|
||||
#[arg(value_name = "PATCH-PATH", required = true, value_parser = parse_patch_path)]
|
||||
patches: Vec<GitPatch>,
|
||||
/// The earliest unique commit ID in the repository.
|
||||
///
|
||||
/// Can be obtained by running `git rev-parse master` (replace 'master' with
|
||||
/// your base branch name).
|
||||
#[arg(long, value_name = "COMMIT-ID")]
|
||||
euc: Sha1,
|
||||
/// Original patch ID if this is a revision of it
|
||||
#[arg(long, value_name = "EVENT-ID")]
|
||||
original_patch: Option<NostrEvent>,
|
||||
@@ -90,6 +84,7 @@ impl CommandRunner for SendArgs {
|
||||
.add_relays(&utils::add_read_relays(relays_list.as_ref()))
|
||||
.await;
|
||||
let repos = client.fetch_repos(&repo_coordinates).await?;
|
||||
let euc = repos.extract_euc();
|
||||
let maintainers = repos.extract_maintainers();
|
||||
client.add_relays(&repos.extract_relays()).await;
|
||||
|
||||
@@ -99,7 +94,7 @@ impl CommandRunner for SendArgs {
|
||||
self.original_patch.as_ref().map(|e| e.event_id),
|
||||
repos.extract_relays().first().cloned(),
|
||||
repo_coordinates,
|
||||
&self.euc,
|
||||
euc,
|
||||
user_pubk,
|
||||
)
|
||||
.await?;
|
||||
@@ -224,7 +219,6 @@ async fn make_patch(
|
||||
let mut safe_dedup_tags = Tags::new();
|
||||
safe_dedup_tags.push(Tag::alt(format!("{PATCH_ALT_PREFIX}{}", patch.subject)));
|
||||
safe_dedup_tags.push(Tag::description(patch.subject));
|
||||
safe_dedup_tags.push(Tag::reference(euc.to_string()));
|
||||
safe_dedup_tags.extend(content_details.into_tags());
|
||||
safe_dedup_tags.extend(
|
||||
repo_coordinates
|
||||
@@ -236,6 +230,9 @@ async fn make_patch(
|
||||
.iter()
|
||||
.map(|c| Tag::public_key(c.public_key)),
|
||||
);
|
||||
if let Some(euc) = euc {
|
||||
safe_dedup_tags.push(Tag::reference(euc.to_string()));
|
||||
}
|
||||
safe_dedup_tags.dedup();
|
||||
let mut event_builder = EventBuilder::new(Kind::GitPatch, patch.inner).tags(safe_dedup_tags);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <https://gnu.org/licenses/gpl-3.0.html>.
|
||||
|
||||
use convert_case::{Case, Casing};
|
||||
use nostr::hashes::sha1::Hash as Sha1Hash;
|
||||
use nostr::{
|
||||
event::{Event, EventBuilder, EventId, Kind, Tag, TagKind, TagStandard, Tags},
|
||||
key::PublicKey,
|
||||
@@ -215,6 +216,11 @@ impl Vec<GitRepositoryAnnouncement> {
|
||||
pub fn extract_maintainers(&self) -> Vec<PublicKey> {
|
||||
self.iter().flat_map(|r| r.maintainers.clone()).collect()
|
||||
}
|
||||
|
||||
/// Gets the first EUC hash from the reposotoies if it exists.
|
||||
pub fn extract_euc(&self) -> Option<&Sha1Hash> {
|
||||
self.iter().find_map(|r| r.euc.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility functions for working with patch events
|
||||
|
||||
Reference in New Issue
Block a user