fetching after push

git4refactor
filip mertens 7 months ago
parent 819202ba09
commit 74a872f0ac
  1. 3
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  2. 3
      libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
  3. 17
      libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx
  4. 1
      libs/remix-ui/git/src/lib/gitactions.ts

@ -33,7 +33,8 @@ export const SourceControlButtons = () => {
}
const push = async () => {
await actions.pull(getRemoteName(), branch ? branch.name : context.currentBranch.name)
await actions.push(getRemoteName(), branch ? branch.name : context.currentBranch.name)
await actions.fetch(getRemoteName(), branch ? branch.name : context.currentBranch.name, null, null, true)
}
const sync = async () => {

@ -47,7 +47,8 @@ export const PushPull = () => {
const push = async () => {
console.log('PUSH', context.upstream, localBranch, remoteBranch, force)
actions.push(context.upstream.remote, localBranch, remoteBranch, force)
await actions.push(context.upstream.remote, localBranch, remoteBranch, force)
await actions.fetch(context.upstream.remote, localBranch, remoteBranch, 1, true)
}
const pull = async () => {

@ -1,6 +1,11 @@
import { ReadCommitResult } from "isomorphic-git"
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 GitUIButton from "../../buttons/gituibutton";
import { gitPluginContext } from "../../gitui";
export interface CommitSummaryProps {
commit: ReadCommitResult;
@ -9,6 +14,7 @@ export interface CommitSummaryProps {
export const CommitSummary = (props: CommitSummaryProps) => {
const { commit, checkout } = props;
const context = React.useContext(gitPluginContext)
const getDate = (commit: ReadCommitResult) => {
const timestamp = commit.commit.author.timestamp;
@ -38,6 +44,15 @@ export const CommitSummary = (props: CommitSummaryProps) => {
return "";
};
const getRemote = (): remote | null => {
return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
}
const openRemote = () => {
if(getRemote())
window.open(`${getRemote().url}/commit/${commit.oid}`, '_blank');
}
return (
<>
<div className="long-and-truncated ml-2">
@ -45,7 +60,7 @@ export const CommitSummary = (props: CommitSummaryProps) => {
</div>
{commit.commit.author.name || ""}
<span className="ml-1">{getDate(commit)}</span>
{getRemote() && getRemote()?.url && <GitUIButton className="btn btn-sm p-0 mx-1 text-muted" onClick={() => openRemote()}><FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon></GitUIButton>}
</>
)
}

@ -384,7 +384,6 @@ export const clone = async (url: string, branch: string, depth: number, singleBr
export const fetch = async (remote?: string, ref?: string, remoteRef?: string, depth?: number, singleBranch?: boolean, relative?: boolean, quiet?: boolean) => {
dispatch(setLoading(true))
await disableCallBacks()
await plugin.call('notification', 'toast', `Fetching ${remote || ''} ${ref || ''} ${remoteRef || ''}`)
try {
await plugin.call('dGitProvider' as any, 'fetch', { remote, ref, remoteRef, depth, singleBranch, relative });
if (!quiet) {

Loading…
Cancel
Save