diff --git a/libs/remix-ui/git/src/components/navigation/commitdetails.tsx b/libs/remix-ui/git/src/components/navigation/commitdetails.tsx index 1cae572a00..2e49875f52 100644 --- a/libs/remix-ui/git/src/components/navigation/commitdetails.tsx +++ b/libs/remix-ui/git/src/components/navigation/commitdetails.tsx @@ -3,6 +3,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import React, { useContext, useEffect } from "react"; import { CommitSummary } from "../panels/commits/commitsummary"; import { ReadCommitResult } from "isomorphic-git" +import { branch } from "../../types"; interface CommitDetailsNavigationProps { commit: ReadCommitResult, @@ -11,10 +12,11 @@ interface CommitDetailsNavigationProps { activePanel: string callback: (eventKey: string) => void isAheadOfRepo: boolean + branch: branch } export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) => { - const { commit, checkout, eventKey, activePanel, callback, isAheadOfRepo } = props; + const { commit, checkout, eventKey, activePanel, callback, isAheadOfRepo, branch } = props; const handleClick = () => { if (!callback) return if (activePanel === eventKey) { @@ -30,7 +32,7 @@ export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) => activePanel === eventKey ? : } - + ); diff --git a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx index 86bdda3c5c..c337648b86 100644 --- a/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx +++ b/libs/remix-ui/git/src/components/panels/commands/pushpull.tsx @@ -19,10 +19,11 @@ export const PushPull = () => { const [force, setForce] = useState(false) useEffect(() => { + console.log('context.currentBranch', context.currentBranch, context.remotes, context.branches) setRemoteBranch(context.currentBranch.name) setLocalBranch(context.currentBranch.name) - const currentUpstreamIsInRemotes = context.upstream && context.remotes.find(r => r.name === context.upstream.name) + const currentUpstreamIsInRemotes = context.upstream && context.remotes.find(r => r.name === context.upstream.name && r.url === context.upstream.url) if (!context.upstream || !currentUpstreamIsInRemotes) { if (context.currentBranch && context.currentBranch.remote && context.currentBranch.remote.name) { actions.setUpstreamRemote(context.currentBranch.remote) diff --git a/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx b/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx index f9b0028c4b..f47e45c993 100644 --- a/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx +++ b/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx @@ -28,7 +28,7 @@ export const CommitDetails = (props: CommitDetailsProps) => { }, [activePanel]) const getRemote = (): remote | null => { - return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null + return branch.remote? branch.remote: context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null } const commitsAhead = (remote: remote) => { @@ -40,19 +40,20 @@ export const CommitDetails = (props: CommitDetailsProps) => { return commitsAhead(getRemote()).findIndex((c) => c.oid === commit.oid) > -1 } - const openFileOnRemote = (file: string, hash: string) => { + const openFileOnRemote = (file: string, hash: string, branch: branch) => { + console.log(branch) if (!getRemote()) return window.open(`${getRemote() ? `${removeGitFromUrl(getRemote().url)}/blob/${hash}/${file}` : ""}`, "_blank") } return ( - + <> {context.commitChanges && context.commitChanges.filter( (change) => change.hashModified === commit.oid && change.hashOriginal === commit.commit.parent[0] ).map((change, index) => { - return () + return () })} diff --git a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx index 50c41dc959..3a02aefd87 100644 --- a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx +++ b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx @@ -9,11 +9,12 @@ import GitUIButton from "../../buttons/gituibutton"; export interface CCommitDetailsItemsProps { commitChange: commitChange; isAheadOfRepo: boolean; - openFileOnRemote: (file: string, hash: string) => void; + openFileOnRemote: (file: string, hash: string, branch: branch) => void; + branch: branch } export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { - const { commitChange, isAheadOfRepo, openFileOnRemote } = props; + const { commitChange, isAheadOfRepo, openFileOnRemote, branch } = props; const actions = React.useContext(gitActionsContext) const pluginActions = React.useContext(pluginActionsContext) @@ -23,7 +24,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { } const openRemote = () => { - openFileOnRemote(commitChange.path, commitChange.hashModified) + openFileOnRemote(commitChange.path, commitChange.hashModified, branch) } function FunctionStatusIcons() { diff --git a/libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx b/libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx index 57cdce36d3..bff01b4712 100644 --- a/libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx +++ b/libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx @@ -3,7 +3,7 @@ import { default as dateFormat } from "dateformat"; import React from "react"; import { faGlobe } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { remote } from "@remix-ui/git"; +import { branch, remote } from "@remix-ui/git"; import GitUIButton from "../../buttons/gituibutton"; import { gitPluginContext } from "../../gitui"; import { removeGitFromUrl } from "../../../utils"; @@ -12,10 +12,11 @@ export interface CommitSummaryProps { commit: ReadCommitResult; checkout: (oid: string) => void; isAheadOfRepo: boolean + branch: branch } export const CommitSummary = (props: CommitSummaryProps) => { - const { commit, checkout, isAheadOfRepo } = props; + const { commit, checkout, isAheadOfRepo, branch } = props; const context = React.useContext(gitPluginContext) const getDate = (commit: ReadCommitResult) => { @@ -47,7 +48,7 @@ export const CommitSummary = (props: CommitSummaryProps) => { }; const getRemote = (): remote | null => { - return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null + return branch.remote? branch.remote: context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null } const openRemote = () => { diff --git a/libs/remix-ui/git/src/lib/listeners.ts b/libs/remix-ui/git/src/lib/listeners.ts index 6e88ba94fa..c2c995f4ce 100644 --- a/libs/remix-ui/git/src/lib/listeners.ts +++ b/libs/remix-ui/git/src/lib/listeners.ts @@ -141,6 +141,12 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch { loadFiles() }) + loadFileQueue.enqueue(async () => { + getBranches() + }) + loadFileQueue.enqueue(async () => { + gitlog() + }) }) plugin.on('manager', 'pluginActivated', async (p: Profile) => { if (p.name === 'dgitApi') {